ExtraCompiler: Parent extra compilers to plugins

Previously the extra compilers were never destructed. As any plugin that
registers an extra compiler factory has to depend on ProjectExplorer, it
will delete its factory before ProjectExplorer is unloaded. So, removing
the extra compiler from the list on destroyed() is safe.

Change-Id: I22fbe662a5704c0294512b8774acb85745c1cbe5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-03-14 10:58:55 +01:00
parent ee729091fd
commit b6c1e58f58
4 changed files with 11 additions and 3 deletions

View File

@@ -354,7 +354,11 @@ ExtraCompilerFactory::ExtraCompilerFactory(QObject *parent) : QObject(parent)
void ExtraCompilerFactory::registerExtraCompilerFactory(ExtraCompilerFactory *factory)
{
factories()->append(factory);
QList<ExtraCompilerFactory *> *factoryList = factories();
factoryList->append(factory);
connect(factory, &QObject::destroyed, [factoryList, factory]() {
factoryList->removeAll(factory);
});
}
QList<ExtraCompilerFactory *> ExtraCompilerFactory::extraCompilerFactories()