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.
Solved by liujac. Go to Solution.
Hi,
Thanks for reporting this issue. I logged a defect (UP-29294) in our internal system. We will fix it.
For now, the workaround is to check if the workspace to be deleted is active, activate another workspace (Workspace.activate()) if the workspace to be deleted is active, and then delete your workspace.
Thanks,
Jack
Can't find what you're looking for? Ask the community or share your knowledge.