Преглед на файлове

libobs: Fix logging of remaining views

OBS has been logging `1 views remain at shutdown` when in reality there
are not technically any views remaining. When views are removed, the
view itself is destroyed immediately, but the mix remains, to be
garbage collected by the graphics thread.

In this case, the view has already been removed, but the graphics
thread has not run an interation and cleaned up the mix, so this
log message appears.

Fixes the issue by checking if a mix actually has an assigned view,
instead of blindly logging existing mixes.

(cherry picked from commit 25df3e183ec2273cf706b9ea9b4ef248153629d1)
tt2468 преди 2 години
родител
ревизия
aa1f7b275b
променени са 1 файла, в които са добавени 8 реда и са изтрити 5 реда
  1. 8 5
      libobs/obs.c

+ 8 - 5
libobs/obs.c

@@ -774,13 +774,16 @@ void obs_free_video_mix(struct obs_core_video_mix *video)
 static void obs_free_video(void)
 {
 	pthread_mutex_lock(&obs->video.mixes_mutex);
-	size_t num = obs->video.mixes.num;
-	if (num)
-		blog(LOG_WARNING, "%zu views remain at shutdown", num);
-	for (size_t i = 0; i < num; i++) {
-		obs_free_video_mix(obs->video.mixes.array[i]);
+	size_t num_views = 0;
+	for (size_t i = 0; i < obs->video.mixes.num; i++) {
+		struct obs_core_video_mix *video = obs->video.mixes.array[i];
+		if (video && video->view)
+			num_views++;
+		obs_free_video_mix(video);
 		obs->video.mixes.array[i] = NULL;
 	}
+	if (num_views > 0)
+		blog(LOG_WARNING, "Number of remaining views: %ld", num_views);
 	pthread_mutex_unlock(&obs->video.mixes_mutex);
 
 	pthread_mutex_destroy(&obs->video.mixes_mutex);