[mutter/cherry-pick-bb6ae40a] onscreen/native: Always free the next framebuffer on dispose
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/cherry-pick-bb6ae40a] onscreen/native: Always free the next framebuffer on dispose
- Date: Sun, 9 Jan 2022 23:38:21 +0000 (UTC)
commit 8e4dd94ffb58933510411255e294d71225175c95
Author: Jonas Ådahl <jadahl gmail com>
Date: Sun Jan 9 23:37:45 2022 +0100
onscreen/native: Always free the next framebuffer on dispose
There was a sanity check that complained if there was still a "next
framebuffer" when disposing an onscreen. This is correct to complain
about under normal operation, as we always wait until receiving the page
flip callback before cleaning up the onscreen and their state.
However, when there are many hotplugs occurring, we might end up with
race conditions when the above sanity check is not valid: when we have
more than one monitor active, paint 1 one of them, but receive a hotplug
event before we paint the other(s), we will discard the already painted
onscreen before really issuing a page flip.
In this situation, we will have the "next framebuffer", but having that
is not a bug, it's a race condition, thus to not leak in this situation,
make sure to clean up the next framebuffer here too.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2081
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2225>
(cherry picked from commit bb6ae40a0feb93727dff8c51bf0560279d8d89db)
src/backends/native/meta-onscreen-native.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
---
diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c
index f244c7fc1a..c9514b9e7a 100644
--- a/src/backends/native/meta-onscreen-native.c
+++ b/src/backends/native/meta-onscreen-native.c
@@ -2037,10 +2037,7 @@ meta_onscreen_native_dispose (GObject *object)
switch (renderer_gpu_data->mode)
{
case META_RENDERER_NATIVE_MODE_GBM:
- /* flip state takes a reference on the onscreen so there should
- * never be outstanding flips when we reach here. */
- g_warn_if_fail (onscreen_native->gbm.next_fb == NULL);
-
+ g_clear_object (&onscreen_native->gbm.next_fb);
free_current_bo (onscreen);
break;
case META_RENDERER_NATIVE_MODE_SURFACELESS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]