Skip to content

Commit aa64d2e

Browse files
jonas2515mtwebster
authored andcommitted
clutter: Bail out and warn on reentry into mapping/unmapping cycle
There's a bunch of crashes right now where the assertions in clutter_actor_set_mapped() after calling the map/unmap() vfuncs are failing. The only way this can happen is by re-entering clutter_actor_set_mapped() during the map/unmap recursion. The reason for those crashes is that the shell hides/shows some actors in response to crossing events and key-focus changes. These in turn get triggered by the newly introduced ungrabbing of ClutterGrabs when an actor gets unmapped, which triggers GRAB_NOTIFY crossing events and key-focus changes. Since these situations are hardly avoidable (it's a valid use-case to hide/show something in response to a crossing/key-focus event), catch the set_mapped() call early while we reenter the mapping machinery and log a warning instead of crashing. ref: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2299 Fixes linuxmint/cinnamon#11086.
1 parent a8068f3 commit aa64d2e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

clutter/clutter/clutter-actor.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,10 @@ clutter_actor_set_mapped (ClutterActor *self,
14131413
if (CLUTTER_ACTOR_IS_MAPPED (self) == mapped)
14141414
return;
14151415

1416+
g_return_if_fail (!CLUTTER_ACTOR_IN_MAP_UNMAP (self));
1417+
1418+
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_MAP_UNMAP);
1419+
14161420
if (mapped)
14171421
{
14181422
CLUTTER_ACTOR_GET_CLASS (self)->map (self);
@@ -1423,6 +1427,8 @@ clutter_actor_set_mapped (ClutterActor *self,
14231427
CLUTTER_ACTOR_GET_CLASS (self)->unmap (self);
14241428
g_assert (!CLUTTER_ACTOR_IS_MAPPED (self));
14251429
}
1430+
1431+
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_MAP_UNMAP);
14261432
}
14271433

14281434
/* this function updates the mapped and realized states according to

clutter/clutter/clutter-private.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ typedef struct _ClutterVertex4 ClutterVertex4;
7272
#define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
7373
#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
7474
#define CLUTTER_ACTOR_IN_PREF_SIZE(a) ((CLUTTER_PRIVATE_FLAGS (a) & (CLUTTER_IN_PREF_HEIGHT|CLUTTER_IN_PREF_WIDTH)) != FALSE)
75+
#define CLUTTER_ACTOR_IN_MAP_UNMAP(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_MAP_UNMAP) != FALSE)
7576

7677
#define CLUTTER_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
7778
#define CLUTTER_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
@@ -109,6 +110,8 @@ typedef enum
109110

110111
/* Used to avoid recursion */
111112
CLUTTER_IN_RELAYOUT = 1 << 7,
113+
114+
CLUTTER_IN_MAP_UNMAP = 1 << 8,
112115
} ClutterPrivateFlags;
113116

114117
/*

0 commit comments

Comments
 (0)