Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
How to correctly delete the new created workspace object in c++?
If I'm in the new created workspace, then the following code crashes fusion 360. If i go to solid workspace and stop the addin, everything works well. so how to avoid this kind of problems. thanks
extern "C" XI_EXPORT bool stop(const char* context)
{
if (!ui)
return false;
/**
* Get global objs
*/
Ptr<Toolbars> toolbars = ui->toolbars();
if (!toolbars)
return false;
Ptr<CommandDefinitions> cmdDefs = ui->commandDefinitions();
if (!cmdDefs)
return false;
Ptr<Workspaces> workspaces = ui->workspaces();
if (!workspaces)
return false;
/*
* Get and release user def objs
*/
//Ptr<Workspace> simericsWorkspace = workspaces->itemById(simericsExistWorkspaceId);
Ptr<Workspace> simericsWorkspace = workspaces->itemById(simericsWorkspaceId);
if (!simericsWorkspace)
return false;
Ptr<ToolbarPanels> tbPanels = simericsWorkspace->toolbarPanels();
if (!tbPanels)
return false;
Ptr<ToolbarPanel> tbPanel = tbPanels->itemById(simericsPanelId);
if (!tbPanel)
return false;
Ptr<ToolbarControls> tbPanelCtrls = tbPanel->controls();
if (!tbPanelCtrls)
return false;
Ptr<ToolbarControl> tbComCtrl = tbPanelCtrls->itemById(simericsComId);
Ptr<CommandDefinition> cmdDef = cmdDefs->itemById(simericsComId);
if (tbPanel)
tbPanel->deleteMe();
if (simericsWorkspace)
simericsWorkspace->deleteMe();
if (tbComCtrl)
tbComCtrl->deleteMe();
if (cmdDef)
cmdDef->deleteMe();
return true;
}
Solved! Go to Solution.