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. The Lounge
  3. New Windows bug causes GDI leaks in MFC apps

New Windows bug causes GDI leaks in MFC apps

Scheduled Pinned Locked Moved The Lounge
helpc++comgraphicsjson
23 Posts 14 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.
  • C Chris Maunder

    I mean that you were strictly limited in the number of GDI objects you could create (without releasing) before the system started refusing to grant you more. You quickly learned to check the return values of system calls :) cheers, Chris Maunder

    CodeProject.com : C++ MVP

    RaviBeeR Offline
    RaviBeeR Offline
    RaviBee
    wrote on last edited by
    #14

    Actually it was much worse in Win 3.1 - I spent several sleepless weekends debugging this[^]. :sigh: /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

    N 1 Reply Last reply
    0
    • RaviBeeR RaviBee

      Actually it was much worse in Win 3.1 - I spent several sleepless weekends debugging this[^]. :sigh: /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #15

      Win 2.0 was even worse still.;) Mind you thankfully that is but a faint memory. Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"

      1 Reply Last reply
      0
      • J Joshua Quick

        For all of you MFC developers out there busy trying to locate what's causing those recent GDI leaks in your app, take a look at this. It turns out running MFC apps on WinXP sp2 and Win2003 leaks GDI resources while XP themes are enabled. The bug report on Microsoft's site is dated this month, so it looks like a recent issue (otherwise I would have been pulling out hairs months ago). Here is their bug report. http://support.microsoft.com/?id=319740[^] I tell ya, this one was driving me nuts for the past week. Going over thousands of lines of code only to discover later that it's not my bug. So, I thought I'd be a good CP member and share this with the rest of you.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #16

        Recent? You must be joking - this issue is at least 12 months old - I first reported it here on CP in September last year. I also successfully got MS to release a patch for this bug, which I view as a personal triumph! I assure you that this problem will have been affecting your MFC apps since XP SP2 was released. Way to go MS! http://www.codeproject.com/lounge.asp?msg=927571&searchkw=mfc+leak&sd=1%2F1%2F2003&ed=10%2F25%2F2005#xx927571xx[^]


        The Rob Blog
        Google Talk: robert.caldecott http://www.codeproject.com/script/comments/forums.asp?msg=927057&forumid=2605&searchkw=mfc+leak+hrgn&sd=1%2F1%2F2004&ed=12%2F31%2F2004#xx927057xx[^] -- modified at 3:18 Tuesday 25th October, 2005

        J 1 Reply Last reply
        0
        • C Chris Maunder

          Anyone remember the fun and games of Win95's GDI? cheers, Chris Maunder

          CodeProject.com : C++ MVP

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #17

          Yes. I'm glad I have more than 64K to work with these days. ;) --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

          1 Reply Last reply
          0
          • C Chris Maunder

            I mean that you were strictly limited in the number of GDI objects you could create (without releasing) before the system started refusing to grant you more. You quickly learned to check the return values of system calls :) cheers, Chris Maunder

            CodeProject.com : C++ MVP

            V Offline
            V Offline
            Vikram A Punathambekar
            wrote on last edited by
            #18

            How dare you post a programming question in the Lou... Oh, it's you, Chris! No, don't mind me... nothing at all... just thought I'd say Hi. ;P Cheers, Vikram.


            http://www.geocities.com/vpunathambekar

            Google talk: binarybandit

            After all is said and done, much is said and little is done.

            1 Reply Last reply
            0
            • L Lost User

              Recent? You must be joking - this issue is at least 12 months old - I first reported it here on CP in September last year. I also successfully got MS to release a patch for this bug, which I view as a personal triumph! I assure you that this problem will have been affecting your MFC apps since XP SP2 was released. Way to go MS! http://www.codeproject.com/lounge.asp?msg=927571&searchkw=mfc+leak&sd=1%2F1%2F2003&ed=10%2F25%2F2005#xx927571xx[^]


              The Rob Blog
              Google Talk: robert.caldecott http://www.codeproject.com/script/comments/forums.asp?msg=927057&forumid=2605&searchkw=mfc+leak+hrgn&sd=1%2F1%2F2004&ed=12%2F31%2F2004#xx927057xx[^] -- modified at 3:18 Tuesday 25th October, 2005

              J Offline
              J Offline
              Joshua Quick
              wrote on last edited by
              #19

              Robert Edward Caldecott wrote:

              Recent? You must be joking - this issue is at least 12 months old

              :wtf: Crap! If this is true, then... 1) All of my long running MFC apps are in jeopardy. 2) Microsoft is seriously not cool. They should have fixed this via Windows Update a long time ago. 3) I made a repost. D'oh! Interestingly enough, I haven't heard of any my long running MFC apps bombing in the past year. These apps run 24/7/365 and periodically create and destroy MDI child windows. Are you sure MS didn't fix this? Anyways, where can I download this patch? (Don't tell me I have to go through their tech support team, do I?)

              L 1 Reply Last reply
              0
              • J Joshua Quick

                Robert Edward Caldecott wrote:

                Recent? You must be joking - this issue is at least 12 months old

                :wtf: Crap! If this is true, then... 1) All of my long running MFC apps are in jeopardy. 2) Microsoft is seriously not cool. They should have fixed this via Windows Update a long time ago. 3) I made a repost. D'oh! Interestingly enough, I haven't heard of any my long running MFC apps bombing in the past year. These apps run 24/7/365 and periodically create and destroy MDI child windows. Are you sure MS didn't fix this? Anyways, where can I download this patch? (Don't tell me I have to go through their tech support team, do I?)

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #20

                They may well of patched this via a Windows Update - there is no way of telling. And yes, I had to go through MS tech support for the hot-fix, so I am not meant to give it to you. :( Oh, and MS support sent me the KB319740 link 12 months ago too. I did find a workaround though - make a call to SetWindowTheme(hWnd, L"", L"") in OnCreate. This means your MDI child windows won't get the XP theme look to their captions, but you'll still get themed controls, etc.


                The Rob Blog
                Google Talk: robert.caldecott

                J G 2 Replies Last reply
                0
                • L Lost User

                  They may well of patched this via a Windows Update - there is no way of telling. And yes, I had to go through MS tech support for the hot-fix, so I am not meant to give it to you. :( Oh, and MS support sent me the KB319740 link 12 months ago too. I did find a workaround though - make a call to SetWindowTheme(hWnd, L"", L"") in OnCreate. This means your MDI child windows won't get the XP theme look to their captions, but you'll still get themed controls, etc.


                  The Rob Blog
                  Google Talk: robert.caldecott

                  J Offline
                  J Offline
                  Joshua Quick
                  wrote on last edited by
                  #21

                  That's good to know. Thanks for the tip Robert.

                  1 Reply Last reply
                  0
                  • C Chris Maunder

                    I mean that you were strictly limited in the number of GDI objects you could create (without releasing) before the system started refusing to grant you more. You quickly learned to check the return values of system calls :) cheers, Chris Maunder

                    CodeProject.com : C++ MVP

                    J Offline
                    J Offline
                    Jorgen Sigvardsson
                    wrote on last edited by
                    #22

                    I painfully remember. :sigh: -- Look straight into the light!

                    1 Reply Last reply
                    0
                    • L Lost User

                      They may well of patched this via a Windows Update - there is no way of telling. And yes, I had to go through MS tech support for the hot-fix, so I am not meant to give it to you. :( Oh, and MS support sent me the KB319740 link 12 months ago too. I did find a workaround though - make a call to SetWindowTheme(hWnd, L"", L"") in OnCreate. This means your MDI child windows won't get the XP theme look to their captions, but you'll still get themed controls, etc.


                      The Rob Blog
                      Google Talk: robert.caldecott

                      G Offline
                      G Offline
                      Gary R Wheeler
                      wrote on last edited by
                      #23

                      Robert Edward Caldecott wrote:

                      They may well of patched this via a Windows Update - there is no way of telling.

                      They haven't :suss:. I spot-checked the XP/SP2 machines I'm responsible for (which I keep Windows Update'd), and none of them included the fix.


                      Software Zen: delete this;

                      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