Browse Source

Unload plugin on exit.

merge-requests/782/head
morg 3 months ago
parent
commit
0eab54f04f
  1. 8
      PluginManager.cpp
  2. 2
      PluginManager.h
  3. 5
      qt/OpenRGBDialog2.cpp
  4. 2
      qt/OpenRGBDialog2.h

8
PluginManager.cpp

@ -329,3 +329,11 @@ void PluginManager::UnloadPlugin(std::string path)
ActivePlugins[plugin_idx].loaded = false;
}
}
void PluginManager::UnloadPlugins()
{
for(const OpenRGBPluginEntry& plugin_entry: ActivePlugins)
{
plugin_entry.plugin->Unload();
}
}

2
PluginManager.h

@ -42,6 +42,8 @@ public:
void LoadPlugin(std::string path);
void UnloadPlugin(std::string path);
void UnloadPlugins();
std::vector<OpenRGBPluginEntry> ActivePlugins;
private:

5
qt/OpenRGBDialog2.cpp

@ -438,7 +438,7 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op
/*-----------------------------------------------------*\
| Add the Plugins page |
\*-----------------------------------------------------*/
AddPluginsPage(plugin_manager);
AddPluginsPage();
/*-----------------------------------------------------*\
| Add the E1.31 settings page |
@ -543,11 +543,12 @@ void OpenRGBDialog2::closeEvent(QCloseEvent *event)
}
else
{
plugin_manager->UnloadPlugins();
event->accept();
}
}
void OpenRGBDialog2::AddPluginsPage(PluginManager* plugin_manager)
void OpenRGBDialog2::AddPluginsPage()
{
/*-----------------------------------------------------*\
| Create the Plugins page |

2
qt/OpenRGBDialog2.h

@ -96,7 +96,7 @@ private:
void AddQMKORGBSettingsPage();
void AddSerialSettingsPage();
void AddYeelightSettingsPage();
void AddPluginsPage(PluginManager* plugin_manager);
void AddPluginsPage();
void AddConsolePage();
void ClearDevicesList();

Loading…
Cancel
Save