fixed CURSOR resource leak
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -138,8 +138,6 @@ wxCursor::wxCursor(const wxString& cursor_file,
|
|||||||
wxCursorRefData *refData = new wxCursorRefData;
|
wxCursorRefData *refData = new wxCursorRefData;
|
||||||
m_refData = refData;
|
m_refData = refData;
|
||||||
|
|
||||||
refData->m_destroyCursor = FALSE;
|
|
||||||
|
|
||||||
if (flags == wxBITMAP_TYPE_CUR_RESOURCE)
|
if (flags == wxBITMAP_TYPE_CUR_RESOURCE)
|
||||||
{
|
{
|
||||||
#ifdef __WIN95__
|
#ifdef __WIN95__
|
||||||
@@ -147,6 +145,7 @@ wxCursor::wxCursor(const wxString& cursor_file,
|
|||||||
#else
|
#else
|
||||||
refData->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), cursor_file);
|
refData->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), cursor_file);
|
||||||
#endif
|
#endif
|
||||||
|
refData->m_destroyCursor = FALSE;
|
||||||
}
|
}
|
||||||
else if (flags == wxBITMAP_TYPE_CUR)
|
else if (flags == wxBITMAP_TYPE_CUR)
|
||||||
{
|
{
|
||||||
@@ -155,7 +154,6 @@ wxCursor::wxCursor(const wxString& cursor_file,
|
|||||||
#else
|
#else
|
||||||
#if wxUSE_RESOURCE_LOADING_IN_MSW
|
#if wxUSE_RESOURCE_LOADING_IN_MSW
|
||||||
refData->m_hCursor = (WXHCURSOR) ReadCursorFile(WXSTRINGCAST cursor_file, wxGetInstance(), &refData->m_width, &refData->m_height);
|
refData->m_hCursor = (WXHCURSOR) ReadCursorFile(WXSTRINGCAST cursor_file, wxGetInstance(), &refData->m_width, &refData->m_height);
|
||||||
refData->m_destroyCursor = TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -163,7 +161,6 @@ wxCursor::wxCursor(const wxString& cursor_file,
|
|||||||
{
|
{
|
||||||
#if wxUSE_RESOURCE_LOADING_IN_MSW
|
#if wxUSE_RESOURCE_LOADING_IN_MSW
|
||||||
refData->m_hCursor = (WXHCURSOR) IconToCursor(WXSTRINGCAST cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &refData->m_width, &refData->m_height);
|
refData->m_hCursor = (WXHCURSOR) IconToCursor(WXSTRINGCAST cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &refData->m_width, &refData->m_height);
|
||||||
refData->m_destroyCursor = TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (flags == wxBITMAP_TYPE_BMP)
|
else if (flags == wxBITMAP_TYPE_BMP)
|
||||||
@@ -180,7 +177,6 @@ wxCursor::wxCursor(const wxString& cursor_file,
|
|||||||
pnt.x = hotSpotX;
|
pnt.x = hotSpotX;
|
||||||
pnt.y = hotSpotY;
|
pnt.y = hotSpotY;
|
||||||
refData->m_hCursor = (WXHCURSOR) MakeCursorFromBitmap(wxGetInstance(), hBitmap, &pnt);
|
refData->m_hCursor = (WXHCURSOR) MakeCursorFromBitmap(wxGetInstance(), hBitmap, &pnt);
|
||||||
refData->m_destroyCursor = TRUE;
|
|
||||||
DeleteObject(hBitmap);
|
DeleteObject(hBitmap);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user