![]() |
Module state data problem |
Post Reply ![]() |
Author | |
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() Posted: 05 June 2008 at 2:52pm |
When tracking a popup menu, we are finding that the code can call LoadImage on one of the theme objects. When it does, it creates an image object (in my case CXTPOffice2007Images object).
The image object is derived from CCmdTarget. When created, CCmdTarget obtains the current module state data pointer and directly stores it in instance data.
Then the CJ code that created the image object stores the object in an array. Later when the toolkitpro DLL unloads, all of these objects are disposed of.
So now we have a race condition where the order that DLLs unload becomes an issue. If the module that was active when the image was created is unloaded before the toolkitpro module, MFC can crash when the CCmdTarget object is given its release from the codejock images (removeall?) method.
Shouldn't the CodeJock code make sure that if it creates and stores a CCmdTarget based CodeJock object that before creating the object the codejock module state should be made the active module state? Otherwise, how can we robustly prevent crashes during shutdown?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Think you can call manually XTPOffice2007Images()->RemoveAll(); in some ExitInstance of your module.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
rdhd ![]() Senior Member ![]() ![]() Joined: 13 August 2007 Location: United States Status: Offline Points: 899 |
![]() ![]() ![]() ![]() ![]() |
Oleg,
Has V13 stopped storing the objects or at least quit waiting until dll unload to let them go?
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |