X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c605b871f0df083d8bd6748b133b19e6b47b1f3f..73ed39b580977913998bbb988e52e474fe9835ae:/src/mac/carbon/icon.cpp?ds=sidebyside diff --git a/src/mac/carbon/icon.cpp b/src/mac/carbon/icon.cpp index 27cc3149d2..a3bd7817c1 100644 --- a/src/mac/carbon/icon.cpp +++ b/src/mac/carbon/icon.cpp @@ -170,6 +170,7 @@ bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, } else { +#if wxUSE_IMAGE wxImage loadimage(filename, type); if (loadimage.Ok()) { @@ -183,6 +184,7 @@ bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, CopyFromBitmap( bmp ) ; return true; } +#endif } } return true ; @@ -192,7 +194,10 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp) { UnRef() ; - m_refData = new wxIconRefData( (WXHICON) wxMacCreateIconRef( bmp ) ) ; + // as the bitmap owns that ref, we have to acquire it as well + IconRef iconRef = bmp.GetBitmapData()->GetIconRef() ; + AcquireIconRef( iconRef ) ; + m_refData = new wxIconRefData( (WXHICON) iconRef ) ; M_ICONDATA->SetWidth( bmp.GetWidth() ) ; M_ICONDATA->SetHeight( bmp.GetHeight() ) ; }