loadDCPlugin(): never call exit() inside a library.
This commit is contained in:
parent
e24022a612
commit
d64b029a2d
@ -52,7 +52,6 @@ hwinf *Update::loadDCPlugin(QDir const &plugInDir, QString const &fname) {
|
|||||||
qCritical() << "in directory" << plugInDir.absolutePath();
|
qCritical() << "in directory" << plugInDir.absolutePath();
|
||||||
qCritical() << "cannot load plugin" << pluginLoader.fileName();
|
qCritical() << "cannot load plugin" << pluginLoader.fileName();
|
||||||
qCritical() << pluginLoader.errorString();
|
qCritical() << pluginLoader.errorString();
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "loadDCPlugin() plugin directory:" << plugInDir.absolutePath();
|
qCritical() << "loadDCPlugin() plugin directory:" << plugInDir.absolutePath();
|
||||||
@ -60,25 +59,20 @@ hwinf *Update::loadDCPlugin(QDir const &plugInDir, QString const &fname) {
|
|||||||
|
|
||||||
if (!pluginLoader.isLoaded()) {
|
if (!pluginLoader.isLoaded()) {
|
||||||
qCritical() << pluginLoader.errorString();
|
qCritical() << pluginLoader.errorString();
|
||||||
exit(-2);
|
|
||||||
}
|
}
|
||||||
QObject *plugin = pluginLoader.instance();
|
QObject *plugin = pluginLoader.instance();
|
||||||
if (!plugin) {
|
if (!plugin) {
|
||||||
qCritical() << "cannot start instance";
|
qCritical() << "cannot start instance";
|
||||||
exit(-3);
|
|
||||||
}
|
}
|
||||||
if (! (hw = qobject_cast<hwinf *>(plugin))) {
|
if (! (hw = qobject_cast<hwinf *>(plugin))) {
|
||||||
qCritical() << "cannot cast plugin" << plugin << "to hwinf";
|
qCritical() << "cannot cast plugin" << plugin << "to hwinf";
|
||||||
exit(-4);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << pluginLibName << "does not exist";
|
qCritical() << pluginLibName << "does not exist";
|
||||||
exit(-5);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "plugins directory" << plugInDir.absolutePath()
|
qCritical() << "plugins directory" << plugInDir.absolutePath()
|
||||||
<< "does not exist";
|
<< "does not exist";
|
||||||
exit(-6);
|
|
||||||
}
|
}
|
||||||
return hw;
|
return hw;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user