mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-19 09:54:15 +01:00
OP-306 Tell core plugin to get rid of the gadgets upon plugin shutdown.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2678 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
77ce0d6391
commit
38fa93312c
@ -954,6 +954,10 @@ void MainWindow::shutdown()
|
||||
disconnect(QApplication::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)),
|
||||
this, SLOT(updateFocusWidget(QWidget*,QWidget*)));
|
||||
m_activeContext = 0;
|
||||
|
||||
// We have to remove all the existing gagdets at his point, not
|
||||
// later!
|
||||
uavGadgetInstanceManager()->removeAllGadgets();
|
||||
}
|
||||
|
||||
void MainWindow::createWorkspaces() {
|
||||
|
@ -67,6 +67,7 @@ UAVGadgetInstanceManager::~UAVGadgetInstanceManager()
|
||||
m_pm->removeObject(page);
|
||||
delete page;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UAVGadgetInstanceManager::readConfigurations(QSettings *qs)
|
||||
@ -275,6 +276,22 @@ void UAVGadgetInstanceManager::removeGadget(IUAVGadget *gadget)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all the gadgets. This is called by the core plugin when
|
||||
* shutting down: this ensures that all registered gadget factory destructors are
|
||||
* indeed called when the GCS is shutting down. We can't destroy them at the end
|
||||
* (coreplugin is deleted last), because the gadgets sometimes depend on other
|
||||
* plugins, like uavobjects...
|
||||
*/
|
||||
void UAVGadgetInstanceManager::removeAllGadgets()
|
||||
{
|
||||
foreach( IUAVGadget *gadget, m_gadgetInstances) {
|
||||
m_gadgetInstances.removeOne(gadget);
|
||||
delete gadget;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool UAVGadgetInstanceManager::canDeleteConfiguration(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
// to be able to delete a configuration, no instance must be using it
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
void writeConfigurations(QSettings *qs);
|
||||
IUAVGadget *createGadget(QString classId, QWidget *parent);
|
||||
void removeGadget(IUAVGadget *gadget);
|
||||
void removeAllGadgets();
|
||||
bool canDeleteConfiguration(IUAVGadgetConfiguration *config);
|
||||
void deleteConfiguration(IUAVGadgetConfiguration *config);
|
||||
void cloneConfiguration(IUAVGadgetConfiguration *config);
|
||||
|
Loading…
x
Reference in New Issue
Block a user