Is this typo 'DeviceMAnager' really in the code or only in the code posted here?:
if (plugin)
{
deviceManager = qobject_cast<DeviceMAnager *>(plugin);
return true;
}
if (plugin)
{
deviceManager = qobject_cast<DeviceMAnager *>(plugin);
return true;
}
To copy to clipboard, switch view to plain text mode
I'd add some defencive code here:
QObject * plugin
= pluginLoader
->instance
();
if (plugin)
{
deviceManager = qobject_cast<DeviceMAnager *>(plugin);
if(deviceManager) return true;
return false;;
}
else
{
delete pluginLoader;
return false;
}
QPluginLoader * pluginLoader = new QPluginLoader(pluginPath.c_str());
QObject * plugin = pluginLoader->instance();
if (plugin)
{
deviceManager = qobject_cast<DeviceMAnager *>(plugin);
if(deviceManager) return true;
return false;;
}
else
{
delete pluginLoader;
return false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks