about CGdiObject assertion failed
-
Hi,all I got an error when I run one window about 80 times.The error is like the following: Second Chance Assertion Failed: File afxwin1.inl, Line 283 source code in "afxwin1.inl" is the following, 282: _AFXWIN_INLINE int CGdiObject::GetObject(int nCount, LPVOID lpObject) const 283: { ASSERT(m_hObject != NULL); return ::GetObject(m_hObject, nCount, lpObject); } m_hObject is a NULL pointer when I load a bitmap(bitmap.LoadBitmap(..)). these code runed for about 80 times recycled, then I get a NULL pointer m_hObject. but I don't know why m_hObject is not a NULL pointer when these code run for the first 80 times. I think it is a memory leak error,but after every CBitmap object was used, DeleteObject() was followed. Could anyone give me some advice about how could result in this error, and how can I fix it. Thanks.
-
Hi,all I got an error when I run one window about 80 times.The error is like the following: Second Chance Assertion Failed: File afxwin1.inl, Line 283 source code in "afxwin1.inl" is the following, 282: _AFXWIN_INLINE int CGdiObject::GetObject(int nCount, LPVOID lpObject) const 283: { ASSERT(m_hObject != NULL); return ::GetObject(m_hObject, nCount, lpObject); } m_hObject is a NULL pointer when I load a bitmap(bitmap.LoadBitmap(..)). these code runed for about 80 times recycled, then I get a NULL pointer m_hObject. but I don't know why m_hObject is not a NULL pointer when these code run for the first 80 times. I think it is a memory leak error,but after every CBitmap object was used, DeleteObject() was followed. Could anyone give me some advice about how could result in this error, and how can I fix it. Thanks.
This '80 times recycled' points to a GDI resource leak. Probably you have your bitmap selected into some device context when you 'recycle'. In such case, old bitmap isn't deleted. Tomasz Sowinski -- http://www.shooltz.com