Print Page | Close Window

CXTPResourceImage crashes application

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=19512
Printed Date: 17 November 2024 at 2:42am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPResourceImage crashes application
Posted By: rdhd
Subject: CXTPResourceImage crashes application
Date 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?



Replies:
Posted By: rdhd
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net