[Closed] SDK Can't delete my plugin ??
Ok, I’m having quite a funny issue with my plugin which is that after I delete it, it’s still holding onto data. So much so that I can delete the plugin, render and it will still be there xD I take it I’m missing something either in the EndEditParams or the deconstructor. Any ideas ??
My_Plugin::~My_Plugin(){
DeleteAllRefsFromMe();
GetCOREInterface()->ClearPickMode();
P1hWnd = NULL;
P2hWnd = NULL;
P3hWnd = NULL;
P4hWnd = NULL;
P5hWnd = NULL;
P6hWnd = NULL;
P7hWnd = NULL;
P8hWnd = NULL;
pblock2 = NULL;
ListTab = NULL;
gw = NULL;
isObjectMode = FALSE;
gotLicence = FALSE;
UnRegisterNotification(NotifyRenderBegin, this, NOTIFY_PRE_RENDER);
UnRegisterNotification(NotifyRenderEnd, this, NOTIFY_POST_RENDER);
}
void My_Plugin::EndEditParams( IObjParam* iop, ULONG flags, Animatable* next ){
if(pg1){
DestroyCPParamMap2(pg1);
pg1 = NULL;
}
if(pg2){
DestroyCPParamMap2(pg2);
pg2 = NULL;
}
if(pg3){
DestroyCPParamMap2(pg3);
pg3 = NULL;
}
if(pg4){
DestroyCPParamMap2(pg4);
pg4 = NULL;
}
if(pg5){
DestroyCPParamMap2(pg5);
pg5 = NULL;
}
if(pg6){
DestroyCPParamMap2(pg6);
pg6 = NULL;
}
if(pg7){
DestroyCPParamMap2(pg7);
pg7 = NULL;
}
if(pg8){
DestroyCPParamMap2(pg8);
pg8 = NULL;
}
GetCOREInterface()->ClearPickMode();
NotifyDependents(Interval(t,t), PART_ALL, REFMSG_END_EDIT);
}
For some reason the deconstructor is not called until you close 3dsmax. So if you delete your object the deconstructor will not be called. I’m not sure why this is?
I just found this post…
http://forums.autodesk.com/t5/programming/sdk-modifier-destructor/m-p/4337597/highlight/false#M11915
very crazy. So after I delete my object plugin and call gc() it just goes though the deconstructor over and over and over, until max crashes
Not sure if this is a bug?
Does anyone have an answer for this yet ?? Like, I find it very odd that Max would only call a deconstructor on Close or if gc() is called. Surely there must be a way to delete the plugin and get rid of all the params at the same time !! I’ve got through the samples and tried seeing if they are doing it, but seems the same as mine, where its only called on close or gc(). So is this normal or is there a way to do this ?? Thanks
It’s likely that the undo/redo system still holds a reference to your deleted object. How do you delete your plugin object, DeleteMe(), DeleteThis() etc?
I am using the DeleteThis void within my plugin, but like the Deconstructor, it doesn’t get called till close or gc(). Ahhh that makes a lot of sense, as it still needs the reference. Ok then, slightly different question, is there anyway to know when my plugin has been deleted ?