Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Memory leaks with CCustomizeDlg::EnableCustomization Collapse All
Subject Author Date
Michael Bailey Aug 16, 2007 - 11:39 PM

Hi,

I’m looking for the proper way to free/delete all the memory used by EnableCustomization(). When I call the following code, I get a bunch of memory leaks when shutting down.

if(!CCustomizeDlg::EnableCustomization(this,__ECSF_DEFAULT)) {
ASSERT( FALSE );
return -1;
}

Is there a shutdown function I should be calling in DestroyWindow()?

Thanks,
Mike


Michael Bailey Aug 18, 2007 - 10:34 PM

Problem solved.

Added AfxOleInit(); to the CApp::InitInstance() no more leaks. Not sure why this is the case, but it works great and the 1000’s of leaks are plugged.

Thanks for the help. Prof-UI is a great tool.

Mike

Technical Support Aug 19, 2007 - 9:58 AM

The OLE initialization is essential because the customization subsystem uses OLE drag-and-drop APIs for menu items and toolbar buttons. But this should have to do with memory leaks. We guess the source of these leaks was specific to your project only.

Technical Support Aug 17, 2007 - 8:09 AM

There are no API that would allows you deinitialize the customization subsystem directly. Everything should be closed and deallocated automatically. If you have memory leaks of MFC/Prof-UIS objects, there must be some problem in the application shutdown. For instance, it may be closed by the ExitThread() or PostQuitMessage() APIs so the destructors won’t be called. Please check if the DestroyWindow() virtual method of the main frame class and the ExitInstance() virtual method of application class are invoked at shutdown. You can also configure the debugger to break on any exceptions before shutdown and clarify what happens during shutdown. Any unhandled exceptions may also crash your application even without any popup message boxes.

Suhai Gyorgy Aug 17, 2007 - 1:42 AM

Just a guess: Have you followed the steps described in the Feature Article Prof-UIS Customization Subsystem ? If so, can you reproduce the problem in any of the customized ProfUIS samples ( in BitmapEditor, for example )?