Here is your patch I applied to mutter downloaded with 'apt source
mutter':

--- mutter-48.1.orig/src/core/place.c   2025-04-01 14:41:18.000000000 +0200
+++ mutter-48.1/src/core/place.c        2025-07-29 17:39:31.777613238 +0200
@@ -990,6 +990,21 @@
 
   windows = find_windows_relevant_for_placement (window);
   logical_monitor = meta_backend_get_current_logical_monitor (backend);
+  if (!logical_monitor)
+  {
+    g_message ("ASSERTION WORKAROUND");
+    MetaMonitorManager *monitor_manager =
+      meta_backend_get_monitor_manager (backend);
+
+    logical_monitor =
+      meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
+
+    if (!logical_monitor) {
+      g_message ("ASSERTION WORKAROUND: NO LOGICAL MONITORS AT ALL");
+      goto done;
+    }
+  }
+
   place_centered = window_place_centered (window);
 
   if (place_centered)
---------------------------------------------------------------------------------------

Unfortunately, this patch still causes a crash (Logs attached) – just like my 
initial workaround.
It crashes on different line -> find_next_cascade (window, windows, &x, &y, 
place_centered);


I believe the crash might be mitigated by modifying the fallback block like 
this:

+    if (!logical_monitor) {
+      goto done;
+    }


If it would help with debugging, I can add some g_message() calls to print out 
relevant variable values at runtime — just let me know which variables would be 
the most useful to inspect in this context.


I'm attaching the backtrace and relevant logs from journalctl.


** Attachment added: "journal_backtrace.log"
   
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2117277/+attachment/5894362/+files/journal_backtrace.log

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2117277

Title:
  gnome-shell crash on unplugging external monitor –
  meta_window_get_work_area_for_logical_monitor assertion

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2117277/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to