Skip to content

Commit 3f5f9e8

Browse files
Fixes some memory leaks, and potential crash-on-quit when AV settings are changed in the config window.
1 parent 8c5bdd7 commit 3f5f9e8

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

src/elgato-cloud-config.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ DefaultAVWidget::~DefaultAVWidget()
236236
audioSigHandler, "update",
237237
DefaultAVWidget::DefaultAudioUpdated, this);
238238
}
239+
if (_videoCaptureSource) {
240+
obs_source_release(_videoCaptureSource);
241+
obs_source_remove(_videoCaptureSource);
242+
}
239243
_levelsWidget = nullptr;
240244
}
241245

@@ -294,6 +298,7 @@ void DefaultAVWidget::save()
294298
else {
295299
obs_data_set_string(config, "DefaultVideoCaptureSettings", "");
296300
}
301+
obs_data_release(settings);
297302
obs_data_release(config);
298303
}
299304

src/elgato-cloud-window.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,14 @@ extern void InitElgatoCloud(obs_module_t *module)
808808
obs_log(LOG_INFO, "version: %s", "0.0.4");
809809

810810
elgatoCloud = new ElgatoCloud(module);
811-
//QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction(
812-
// "Elgato Marketplace");
813-
//action->connect(action, &QAction::triggered, OpenElgatoCloudWindow);
811+
QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction(
812+
"Elgato Marketplace");
813+
action->connect(action, &QAction::triggered, OpenElgatoCloudWindow);
814+
}
815+
816+
extern void ShutDown()
817+
{
818+
delete elgatoCloud;
814819
}
815820

816821
extern obs_data_t *GetElgatoCloudConfig()

src/plugin-module.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ namespace elgatocloud {
4040
extern void InitElgatoCloud(obs_module_t *);
4141
extern obs_data_t* GetElgatoCloudConfig();
4242
extern void OpenExportWizard();
43+
extern void ShutDown();
4344
}
4445

4546
void save_pack()
@@ -70,19 +71,20 @@ bool obs_module_load(void)
7071
obs_log(LOG_INFO, "plugin loaded successfully (version %s)",
7172
PLUGIN_VERSION);
7273
elgatocloud::InitElgatoCloud(obs_current_module());
73-
auto config = elgatocloud::GetElgatoCloudConfig();
74-
bool makerTools = obs_data_get_bool(config, "MakerTools");
75-
obs_data_release(config);
76-
if (makerTools || true) {
77-
obs_frontend_add_tools_menu_item("Export Marketplace Scene",
78-
export_collection, NULL);
79-
obs_frontend_add_tools_menu_item("Import Marketplace Scene",
80-
import_collection, NULL);
81-
}
74+
//auto config = elgatocloud::GetElgatoCloudConfig();
75+
//bool makerTools = obs_data_get_bool(config, "MakerTools");
76+
//obs_data_release(config);
77+
//if (makerTools) {
78+
// obs_frontend_add_tools_menu_item("Export Marketplace Scene",
79+
// export_collection, NULL);
80+
// obs_frontend_add_tools_menu_item("Import Marketplace Scene",
81+
// import_collection, NULL);
82+
//}
8283
return true;
8384
}
8485

8586
void obs_module_unload(void)
8687
{
88+
elgatocloud::ShutDown();
8789
obs_log(LOG_INFO, "plugin unloaded");
8890
}

0 commit comments

Comments
 (0)