Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - CXTPResourceImage crashes application
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPResourceImage crashes application

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CXTPResourceImage crashes application
    Posted: 21 February 2012 at 11:39am
We have a number of MFC modules loaded into our app. Some of these are for active x controls and these DLLs can get unloaded at any time (say when the last object served by the DLL is released).
 
I have found that the

CXTPToolTipContext::DrawBackground method does this:

CXTPResourceImage* pImage = pImages->LoadFile(_T("TOOLTIPFRAME"));

If the first tooltip to display comes from one of our ActiveX controls, the resource image CodeJock creates grabs and stores the module state data pointer of the ActiveX control. That would be fine except that the CXTPResourceImages (the pImages in the above call) is stored in static data in CodeJock. Once loaded, the image remains loaded. Later when we are shutting down and the command bars object (ribbon bar in the frame) is destroyed, the CodeJock code removes all the images. But this is occuring during shutdown and this is the frame so many of the DLLs loaded by the OS have already been unloaded. The result is that the image for the "TOOLTIPFRAME", which has stored a module state data pointer that is no longer in the process crashes the application.
 
Since CodeJock is loading its own image and storing it in static data until the frame is destroyed, should CodeJock not make sure it is the CodeJock (or the application's) module state data pointer being stored in the resource image object?
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2014 at 9:12am
I was asked how I solved this problem. I locked and loaded our active X DLLs into the process. I don't unload them until our main DLL unloads from the process.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.157 seconds.