From 36352f44f9547ea1d1564f8b0723d5592d29638a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 24 Feb 2021 09:36:52 +0100 Subject: [PATCH] onscreen/native: Add ref to dumb buffer when using as scanout buffer Each next and current scanout buffer has a reference on them making sure they stay alive. When dumb buffers were used on the secondary GPU state, this didn't happen, leading to crashes due to unref:ing one time too many, with backtraces such as 0) g_type_check_instance_is_fundamentally_a () 1) g_object_unref () 2) secondary_gpu_release_dumb () 3) import_shared_framebuffer () 4) update_secondary_gpu_state_post_swap_buffers () 5) meta_onscreen_native_swap_buffers_with_damage () 6) cogl_onscreen_swap_buffers_with_damage () 7) swap_framebuffer () 8) clutter_stage_cogl_redraw_view_primary () 9) clutter_stage_cogl_redraw_view () 10) _clutter_stage_window_redraw_view () 11) handle_frame_clock_frame () Part-of: --- src/backends/native/meta-onscreen-native.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c index 24b8e5ad7..b0230d453 100644 --- a/src/backends/native/meta-onscreen-native.c +++ b/src/backends/native/meta-onscreen-native.c @@ -782,8 +782,7 @@ copy_shared_framebuffer_primary_gpu (CoglOnscreen *onscre g_object_unref (dmabuf_fb); - g_clear_object (&secondary_gpu_state->gbm.next_fb); - secondary_gpu_state->gbm.next_fb = buffer; + g_set_object (&secondary_gpu_state->gbm.next_fb, buffer); secondary_gpu_state->cpu.current_dumb_fb = buffer_dumb; return TRUE;