decklink-output-ui: Don't update UI during shutdown

Fixes a crash on exit if the user exited with the outputs running as the
parent window will have already destroyed doUI.
This commit is contained in:
Richard Stanway 2021-08-19 00:04:52 +02:00
parent 4bf81e9bf6
commit e8d4de6bec

View File

@ -14,6 +14,8 @@ OBS_MODULE_USE_DEFAULT_LOCALE("decklink-output-ui", "en-US")
DecklinkOutputUI *doUI; DecklinkOutputUI *doUI;
bool shutting_down = false;
bool main_output_running = false; bool main_output_running = false;
bool preview_output_running = false; bool preview_output_running = false;
@ -56,6 +58,8 @@ void output_stop()
obs_output_stop(output); obs_output_stop(output);
obs_output_release(output); obs_output_release(output);
main_output_running = false; main_output_running = false;
if (!shutting_down)
doUI->OutputStateChanged(false); doUI->OutputStateChanged(false);
} }
@ -71,6 +75,7 @@ void output_start()
main_output_running = started; main_output_running = started;
if (!shutting_down)
doUI->OutputStateChanged(started); doUI->OutputStateChanged(started);
if (!started) if (!started)
@ -135,6 +140,8 @@ void preview_output_stop()
obs_remove_tick_callback(preview_tick, &context); obs_remove_tick_callback(preview_tick, &context);
preview_output_running = false; preview_output_running = false;
if (!shutting_down)
doUI->PreviewOutputStateChanged(false); doUI->PreviewOutputStateChanged(false);
} }
@ -191,6 +198,7 @@ void preview_output_start()
bool started = obs_output_start(context.output); bool started = obs_output_start(context.output);
preview_output_running = started; preview_output_running = started;
if (!shutting_down)
doUI->PreviewOutputStateChanged(started); doUI->PreviewOutputStateChanged(started);
if (!started) if (!started)
@ -333,6 +341,8 @@ bool obs_module_load(void)
void obs_module_unload(void) void obs_module_unload(void)
{ {
shutting_down = true;
if (preview_output_running) if (preview_output_running)
preview_output_stop(); preview_output_stop();