diff --git a/widget/gtk/MozContainerWayland.cpp b/widget/gtk/MozContainerWayland.cpp index a47239c66450..b2b6cbee4f76 100644 --- a/widget/gtk/MozContainerWayland.cpp +++ b/widget/gtk/MozContainerWayland.cpp @@ -244,6 +244,7 @@ static void moz_container_wayland_frame_callback_handler( { // Protect mozcontainer internals changes by container_lock. MutexAutoLock lock(*wl_container->container_lock); + g_clear_pointer(&wl_container->frame_callback_handler, wl_callback_destroy); // It's possible that container is already unmapped so quit in such case. if (!wl_container->surface) { LOGWAYLAND(" container in unmapped, quit."); @@ -251,7 +252,6 @@ static void moz_container_wayland_frame_callback_handler( "MozContainer should be unmapped."); return; } - g_clear_pointer(&wl_container->frame_callback_handler, wl_callback_destroy); if (wl_container->ready_to_draw) { return; }