@@ -177,18 +177,24 @@ void PluginManagerWindow::setupInstalledPage(std::vector<std::string> failedModu
177177 : metadata.module_name .c_str ();
178178 QString version = !metadata.version .empty () ? metadata.version .c_str () : " " ;
179179
180- Entry newEntry{& metadata, name, category, isLegacyModule};
180+ Entry newEntry{metadata, name, category, isLegacyModule};
181181 installedPluginEntries.push_back (newEntry);
182182 }
183183
184184 for (const std::string &moduleName : failedModules) {
185185 // This failed module is not in the plugin manager cache which means it has never been loaded successfully.
186186 // Create a dummy visual entry for it.
187+ OBS ::ModuleInfo dummyModule;
187188 QString name = QString::fromStdString (moduleName.data ());
188189 Category category{Category::Error};
189190 bool isLegacy{false };
191+ bool hasLoadedBefore{false };
190192
191- Entry newEntry{nullptr , name, category, isLegacy};
193+ dummyModule.module_name = moduleName;
194+ dummyModule.enabled = false ;
195+ dummyModule.enabledAtLaunch = false ;
196+
197+ Entry newEntry{dummyModule, name, category, isLegacy, hasLoadedBefore};
192198 installedPluginEntries.push_back (newEntry);
193199 }
194200
@@ -217,25 +223,34 @@ void PluginManagerWindow::setupInstalledPage(std::vector<std::string> failedModu
217223
218224 if (entry.category == Category::Installed) {
219225 installedPluginList->addRow (newRow);
220-
221- connect (newRow, &InstalledPluginRow::toggleChanged, this ,
222- [this ]() { ui->manageRestartLabel ->setVisible (isEnabledPluginsChanged ()); });
223-
224226 } else if (entry.category == Category::Error) {
225227 errorPluginList->addRow (newRow);
226228 } else if (entry.category == Category::Missing) {
227229 missingPluginList->addRow (newRow);
228230
229- connect (newRow, &InstalledPluginRow::trashClicked, this , [this , newRow, entry]() {
230- auto it = std::find_if (modules_.begin (), modules_.end (), [&entry](const auto &module ) {
231- return &module == entry.module ;
232- });
231+ connect (newRow, &InstalledPluginRow::trashClicked, this , [this , entry]() {
232+ auto it = std::find_if (modules_.begin (), modules_.end (),
233+ [&entry](const ModuleInfo &module ) {
234+ return module .module_name == entry.module .module_name ;
235+ });
233236
234237 if (it != modules_.end ()) {
235238 modules_.erase (it);
236239 }
237240 });
238241 }
242+
243+ connect (newRow, &InstalledPluginRow::toggleChanged, this , [this , entry](bool enabled) {
244+ auto it = std::find_if (modules_.begin (), modules_.end (), [&entry](const ModuleInfo &module ) {
245+ return module .module_name == entry.module .module_name ;
246+ });
247+
248+ if (it != modules_.end ()) {
249+ it->enabled = enabled;
250+ }
251+
252+ ui->manageRestartLabel ->setVisible (isEnabledPluginsChanged ());
253+ });
239254 }
240255
241256 setTabOrder (previousRow, ui->buttonBox );
@@ -293,7 +308,7 @@ bool PluginManagerWindow::isEnabledPluginsChanged()
293308 bool result = false ;
294309 for (auto &entry : installedPluginEntries) {
295310 // Only prompt for restart when a loadable plugin entry changed.
296- if (entry.category == Category::Installed && entry.module -> enabledAtLaunch != entry.module -> enabled ) {
311+ if (entry.category == Category::Installed && entry.module . enabledAtLaunch != entry.module . enabled ) {
297312 result = true ;
298313 break ;
299314 }
0 commit comments