Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. about CGdiObject assertion failed

about CGdiObject assertion failed

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsperformancequestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hj312
    wrote on last edited by
    #1

    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.

    T 1 Reply Last reply
    0
    • H hj312

      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.

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups