From a8c481a80e413b56ae7449b216724dc0ec061ac3 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 17 May 2022 15:26:12 -0700 Subject: [PATCH] libobs: Only warn when releasing non-NULL source Only warn when the pointer provided to obs_source_release() is non-NULL. In some custom usages of libobs, libobs may be freed before OBS* smart pointers (like OBSSource) are destructed, leading to a misleading warning if the pointers have already been cleared with nullptr. Previous behavior is basically: - Clear OBS* pointers with nullptr - Unload libobs - Those smart pointers that were cleared will still call obs_source_release() on destruct - Warning appears --- libobs/obs-source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index aaa49e9e5..ff1648379 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -756,7 +756,7 @@ void obs_source_addref(obs_source_t *source) void obs_source_release(obs_source_t *source) { - if (!obs) { + if (!obs && source) { blog(LOG_WARNING, "Tried to release a source when the OBS " "core is shut down!"); return;