Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

call ~simple_viewer on exit

Help
2004-11-24
2013-04-15
  • Hi, John!

    If I close Simple_Viewer test application by clicking close button in right up corner of the window, destructor ~simple_viewer is called (file "simple_viewer.h" line 227).
    But if I close it through main menu, clicking Exit,  this destructor isn't called. So, resources leak is possible.

    Is this a bug?
    Can you tell me a hint, how to avoid it?

    P.s. win32gui version 1.6.1

    Sincerely yours,
    Victor Derevyanko.

     
    • John Torjo
      John Torjo
      2004-11-24

      It's a bug :(

      The workaround is to manually destroy the window:
      Something like this:

      wnd<> top = create_wnd<sdi_frame>(...);
      top->wait();
      top->destroy();

      Best,
      John

       
    • thank you! :)
      I have tried to do smth like that, but in the wrong way :)

      if (top->is_valid()) top->destroy();
      seems to work correctly in all cases.

      Best regards,
      Victor.