X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e90c1d2a19361551eb07778280f22be3e759cf64..476607a777ec5328804da0564364b70128725647:/src/msw/bitmap.cpp diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 2bf574d245..9498c65e43 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -77,22 +77,14 @@ wxBitmapRefData::wxBitmapRefData() wxBitmapRefData::~wxBitmapRefData() { - if (m_selectedInto) - { - wxChar buf[200]; - wxSprintf(buf, T("Bitmap was deleted without selecting out of wxMemoryDC %lX."), (unsigned long) m_selectedInto); - wxFatalError(buf); - } - if (m_hBitmap) - { - DeleteObject((HBITMAP) m_hBitmap); - } - m_hBitmap = 0 ; + wxASSERT_MSG( !m_selectedInto, + wxT("deleting bitmap still selected into wxMemoryDC") ); - if (m_bitmapMask) - delete m_bitmapMask; - m_bitmapMask = NULL; + if ( m_hBitmap) + DeleteObject((HBITMAP) m_hBitmap); + if ( m_bitmapMask ) + delete m_bitmapMask; } // ---------------------------------------------------------------------------- @@ -143,12 +135,9 @@ bool wxBitmap::FreeResource(bool WXUNUSED(force)) if ( !M_BITMAPDATA ) return FALSE; - if (M_BITMAPDATA->m_selectedInto) - { - wxChar buf[200]; - wxSprintf(buf, T("Bitmap %lX was deleted without selecting out of wxMemoryDC %lX."), (unsigned long) this, (unsigned long) M_BITMAPDATA->m_selectedInto); - wxFatalError(buf); - } + wxASSERT_MSG( !M_BITMAPDATA->m_selectedInto, + wxT("freeing bitmap still selected into wxMemoryDC") ); + if (M_BITMAPDATA->m_hBitmap) { DeleteObject((HBITMAP) M_BITMAPDATA->m_hBitmap); @@ -255,7 +244,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning(T("no bitmap handler for type %d defined."), type); + wxLogWarning(wxT("no bitmap handler for type %d defined."), type); return FALSE; } @@ -272,7 +261,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning(T("no bitmap handler for type %d defined."), type); + wxLogWarning(wxT("no bitmap handler for type %d defined."), type); return FALSE; } @@ -285,7 +274,7 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning(T("no bitmap handler for type %d defined."), type); + wxLogWarning(wxT("no bitmap handler for type %d defined."), type); return FALSE; } @@ -352,9 +341,10 @@ void wxBitmap::SetMask(wxMask *mask) void wxBitmap::SetHBITMAP(WXHBITMAP bmp) { if (!M_BITMAPDATA) - m_refData = new wxBitmapRefData; + m_refData = new wxBitmapRefData; M_BITMAPDATA->m_hBitmap = bmp; + M_BITMAPDATA->m_ok = bmp != 0; } void wxBitmap::AddHandler(wxBitmapHandler *handler) @@ -682,7 +672,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long } // it's probably not found - wxLogError(T("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str()); + wxLogError(wxT("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str()); return FALSE; }