GNOME Bugzilla – Bug 96928
Crash when closing windows
Last modified: 2004-12-22 21:47:04 UTC
I got tired of the random crashes in metacity when closing windows and sat down and got you this nice backtrace of it :) It's the 2.1.x stuff, but I think the bug is still in the 2.0.x branches too. Attaching backtrace.
Created attachment 11858 [details] stack trace
Thanks, hrm. Note there's already a bug about this with a couple other backtraces, both of which are different. So I think it may be one of those horrible memory corruption thingies. You might want to try a MALLOC_CHECK_=2 backtrace, just to see. For completeness, what theme are you using? If you run "metacity/src/wm-tester/wm-tester --evil" does that crash it for you? It doesn't seem to for me. However, if the crash is related to the code in your backtrace, it would only crash in cases where we have windows transient for one another, such as dialogs. Maybe I'll enhance wm-tester --evil to do that.
I added transiency to wm-tester, still doesn't crash it for me. Perhaps it's related to focus mode? GTK version?
This is with the 2.1.x stuff from CVS today.
I think I have the same problem. When the crash occurs, on entering add_constraint() the value of below->stack_position is -1, hence the segfault when trying to address element -1 of the array. This indicates that the group window is not in the metacity stack, but is in the group window list. How or why this happens or whether it is valid is beyond me, but the attached patch (against current cvs) "fixes" it.
Created attachment 11867 [details] [review] patch to prevent crash on window close
after slightly more testing, it seems my patch is almost certainly bogus. it does fix the "crash on close" I was getting, but causes much more serious problems. Back to staring at code for a while ...
Okay last comment for today or else I risk flooding ppls mailboxes. I now believe my patch does indeed fix the crash without introducing any new problems but there is still something wrong. (see below) Further information: This bug does not seem to exist in the version of metacity shipped with redhat 8.0 The application I use to most easily reproduce this is "grustibus" from http://grustibus.sourceforge.net/ Run the app, press the preferences button, select the "list settings" tab, press the font prompt button to open the font selection window. Now upon closing the font selection window metacity will crash. My patch fixes this, but the font window appears behind the prefs window in the stack. With sawfish, twm, and the rh8 metacity, is it in front of the prefs window.
Ah, good catch. The root problem here I think is calling meta_window_shutdown_group() so late in meta_window_free(), it should probably be moved much earlier, so a mostly-destroyed window doesn't remain in the group. I just put in a patch that tries fixing it that way. See if it works...
Thanks. That looks like the proper fix, and works with my example. The stacking issue mentioned above still exists though, but it's clearly a seperate problem. I will try to understand if it could be an application bug and if it still seems like a problem, I'll raise another bug. (and if I understand it enough, perhaps even fix it :) IMO, this can be closed now.
Works for me with ggv on 2.1.x too. Closing. Thanks for the quick fix.
*** Bug 97231 has been marked as a duplicate of this bug. ***