View Single Post
Old 03-09-2017, 02:24 PM   #9
jack461
Human being with feelings
 
jack461's Avatar
 
Join Date: Nov 2013
Location: France
Posts: 181
Default

I had a (possibly) similar problem, because (to make a long story short) I have created controls that depend on other objects defined in my main plug-in class. When the plug-in quits, the destructor of the class deletes these objects, but the controls themselves remain referenced in IGraphics. When finally these controls are destructed in IGraphics.cpp, the destruction fails because the controls use objects that do not exist anymore.

It took me some time, but the best solution I found is to add this method in the class IGraphics, in IGraphics.h:
Code:
virtual void KillControls();
this code in IGraphics.cpp:
Code:
void IGraphics::KillControls()
{
    mControls.Empty(true);
}
and to call this in the appropriate place of my plug-in class destructor.
Code:
GetGUI()->KillControls();
So far, this seems to have worked correctly for months... And it doesn't break the other plug-ins.

Hope this helps.
jack461 is offline   Reply With Quote