Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Module state data problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Module state data problem

 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: 899
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: Module state data problem
    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?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 06 June 2008 at 1:08am
Hi,
 
Think you can call manually XTPOffice2007Images()->RemoveAll(); in some ExitInstance of your module.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 899
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2009 at 6:56pm
Oleg,
 
Has V13 stopped storing the objects or at least quit waiting until dll unload to let them go?
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.031 seconds.