Skip to content

Commit 5560c79

Browse files
committed
Don't queue release when exiting
1 parent 26d9089 commit 5560c79

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

source-record.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct source_record_filter_context {
4343
int audio_track;
4444
obs_weak_source_t *audio_source;
4545
bool closing;
46+
bool exiting;
4647
long long replay_buffer_duration;
4748
struct vec4 backgroundColor;
4849
bool remove_after_record;
@@ -292,9 +293,13 @@ void release_output_stopped(void *data, calldata_t *cd)
292293
{
293294
UNUSED_PARAMETER(cd);
294295
struct stop_output *so = data;
295-
run_queued((obs_task_t)obs_output_release, so->output);
296+
if (!so->context->exiting)
297+
run_queued((obs_task_t)obs_output_release, so->output);
296298
if (so->context->encoder || so->context->audioEncoder[0])
297-
run_queued(release_encoders, so->context);
299+
if (so->context->exiting)
300+
release_encoders(so->context);
301+
else
302+
run_queued(release_encoders, so->context);
298303
bfree(data);
299304
}
300305

@@ -1019,8 +1024,11 @@ static void frontend_event(enum obs_frontend_event event, void *data)
10191024
context->last_frontend_event = (int)event;
10201025

10211026
obs_queue_task(OBS_TASK_GRAPHICS, update_task, data, false);
1022-
} else if (event == OBS_FRONTEND_EVENT_EXIT || event == OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP ||
1023-
event == OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN) {
1027+
} else if (event == OBS_FRONTEND_EVENT_EXIT || event == OBS_FRONTEND_EVENT_SCRIPTING_SHUTDOWN) {
1028+
context->closing = true;
1029+
context->exiting = true;
1030+
obs_source_update(context->source, NULL);
1031+
} else if (event == OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP) {
10241032
context->closing = true;
10251033
obs_source_update(context->source, NULL);
10261034
}

0 commit comments

Comments
 (0)