Skip to content

Commit 8d42913

Browse files
committed
bugfixes
1 parent 4712857 commit 8d42913

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

plugins/gui/src/plugin_relay/gui_plugin_manager.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,24 @@ namespace hal {
376376
if (!ebp) return;
377377

378378
mWaitForRefresh = true;
379-
if (QMessageBox::information(QApplication::activeWindow(),
380-
"Reload Plugin?", "External HAL plugin\n" + ebp->sourcePath() + "\nchanged on disk. Reload?",
381-
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes)
379+
if (QFileInfo(ebp->sourcePath()).isReadable())
382380
{
383-
std::string pluginName = ebp->pluginName().toStdString();
384-
plugin_manager::unload(pluginName);
385-
ebp->updateLibraryPath();
386-
plugin_manager::load(pluginName, ebp->targetPath().toStdString());
381+
if (QMessageBox::information(QApplication::activeWindow(),
382+
"Reload Plugin?", "External HAL plugin\n" + ebp->sourcePath() + "\nchanged on disk. Reload?",
383+
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes)
384+
{
385+
std::string pluginName = ebp->pluginName().toStdString();
386+
plugin_manager::unload(pluginName);
387+
ebp->updateLibraryPath();
388+
plugin_manager::load(pluginName, ebp->targetPath().toStdString());
389+
}
390+
}
391+
else
392+
{
393+
QMessageBox::information(QApplication::activeWindow(),
394+
"Unload Plugin", "External HAL plugin\n" + ebp->sourcePath() + "\nremoved from disk.\nPlugin will be unloaded.",
395+
QMessageBox::Ok);
396+
changeState(ebp->pluginName(),GuiPluginEntry::NotLoaded);
387397
}
388398
mWaitForRefresh = false;
389399
}
@@ -408,13 +418,12 @@ namespace hal {
408418

409419
std::set<std::string> loadedPlugins = plugin_manager::get_plugin_names();
410420

421+
// fill pluginEntries container with elements from settings array
411422
int nentry = mSettings->beginReadArray("plugins");
412423
for (int i=0; i<nentry; i++)
413424
{
414425
mSettings->setArrayIndex(i);
415426
GuiPluginEntry* gpe = new GuiPluginEntry(mSettings);
416-
if (gpe->mExternalBinaryPlugin)
417-
connect(gpe->mExternalBinaryPlugin->mFileWatcher, &QFileSystemWatcher::fileChanged, this, &GuiPluginTable::handleExternalBinaryPluginChanged);
418427
pluginEntries.insert(gpe->mName,gpe);
419428
}
420429
mSettings->endArray();

0 commit comments

Comments
 (0)