Fail in CloneGDIRefData() instead of implementing it incorrectly in wxOSX.

wxIcon and wxMetaFile implemented CloneGDIRefData() using copy ctors of the
corresponding ref data classes but the copy ctors were either wrong (for
wxIconRefData as using it would result in messing up IconRef reference count)
or had wrong semantics (wxMetafileRefData copy ctor performed shallow copy
only while CloneGDIRefData() supposes a deep copy is done).

Replace the wrong implementations of these functions with assert that will be
triggered if they are ever used (which doesn't seem to be the case so far).

See #12768.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66373 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-12-14 18:43:39 +00:00
parent fc684792c6
commit f9b4d680d7
2 changed files with 18 additions and 4 deletions

View File

@@ -50,6 +50,9 @@ private:
IconRef m_iconRef; IconRef m_iconRef;
int m_width; int m_width;
int m_height; int m_height;
// We can (easily) copy m_iconRef so we don't implement the copy ctor.
wxDECLARE_NO_COPY_CLASS(wxIconRefData);
}; };
@@ -124,9 +127,12 @@ wxGDIRefData *wxIcon::CreateGDIRefData() const
return new wxIconRefData; return new wxIconRefData;
} }
wxGDIRefData *wxIcon::CloneGDIRefData(const wxGDIRefData *data) const wxGDIRefData *
wxIcon::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
{ {
return new wxIconRefData(*static_cast<const wxIconRefData *>(data)); wxFAIL_MSG( wxS("Cloning icons is not implemented in wxCarbon.") );
return new wxIconRefData;
} }
WXHICON wxIcon::GetHICON() const WXHICON wxIcon::GetHICON() const

View File

@@ -76,6 +76,11 @@ private:
int m_width ; int m_width ;
int m_height ; int m_height ;
// Our m_pdfDoc field can't be easily (deep) copied and so we don't define a
// copy ctor.
wxDECLARE_NO_COPY_CLASS(wxMetafileRefData);
}; };
wxMetafileRefData::wxMetafileRefData(CFDataRef data) : wxMetafileRefData::wxMetafileRefData(CFDataRef data) :
@@ -175,9 +180,12 @@ wxGDIRefData *wxMetaFile::CreateGDIRefData() const
return new wxMetafileRefData; return new wxMetafileRefData;
} }
wxGDIRefData *wxMetaFile::CloneGDIRefData(const wxGDIRefData *data) const wxGDIRefData *
wxMetaFile::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
{ {
return new wxMetafileRefData(*static_cast<const wxMetafileRefData *>(data)); wxFAIL_MSG( wxS("Cloning metafiles is not implemented in wxCarbon.") );
return new wxMetafileRefData;
} }
WXHMETAFILE wxMetaFile::GetHMETAFILE() const WXHMETAFILE wxMetaFile::GetHMETAFILE() const