Unverified Commit 1893a920 authored by Alex Wilkinson's avatar Alex Wilkinson Committed by GitHub

Correctly set parent of QGCCorePlugin

QGCCorePlugin is currently constructed with a QGCToolbox* toolbx parameter of null. This is because at the time QGCCorePlugin (or an actual custom plugin) is constructed app->toolbox() is null.
_scanAndLoadPlugins() is called as part of the QGCToolbox constructor where all toolbox classes use the same format:
_class = new Class(app, this);

The creation of QGCCorePlugin should follow the same pattern.

The practical issue I had with this is that because the parent is not set correctly, QGCCorePlugin is not destructed when the app is closed. This means any code in the destructor is not run. (QGCCorePlugin itself has as a destructor which is currently not being called).
parent f711da24
......@@ -134,13 +134,13 @@ void QGCToolbox::_scanAndLoadPlugins(QGCApplication* app)
#if defined (QGC_CUSTOM_BUILD)
//-- Create custom plugin (Static)
_corePlugin = (QGCCorePlugin*) new CUSTOMCLASS(app, app->toolbox());
_corePlugin = (QGCCorePlugin*) new CUSTOMCLASS(app, this);
if(_corePlugin) {
//-- No plugins found, use default instance
_corePlugin = new QGCCorePlugin(app, app->toolbox());
_corePlugin = new QGCCorePlugin(app, this);
QGCTool::QGCTool(QGCApplication* app, QGCToolbox* toolbox)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment