GNOME Bugzilla – Bug 599988
Toplevel with TYPE_HINT_NOTIFICATION causes crash
Last modified: 2011-10-17 19:11:01 UTC
This simple pygtk program will crash mutter: -- #!/usr/bin/env python import gtk w = gtk.Window() w.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_NOTIFICATION) w.show_all() gtk.main() -- The crash is: Window manager warning: Log level 8: meta_theme_get_frame_style: assertion `type < META_FRAME_TYPE_LAST' failed Window manager warning: Log level 8: meta_theme_get_title_scale: assertion `type < META_FRAME_TYPE_LAST' failed Window manager warning: Log level 8: meta_theme_calc_geometry: assertion `type < META_FRAME_TYPE_LAST' failed Window manager warning: Log level 8: meta_frames_get_geometry: assertion `type < META_FRAME_TYPE_LAST' failed Window manager warning: Log level 8: meta_theme_get_frame_style: assertion `type < META_FRAME_TYPE_LAST' failed Window manager warning: Log level 8: meta_theme_calc_geometry: assertion `type < META_FRAME_TYPE_LAST' failed Window manager warning: Log level 16: Native children wider or taller than 65535 pixels are not supported Window manager warning: Log level 8: meta_theme_get_frame_style: assertion `type < META_FRAME_TYPE_LAST' failed [1] 14858 segmentation fault mutter --replace
Created attachment 195629 [details] [review] untested patch
Seems like an ugly fix - if the assertion here is that windows of type NOTIFICATION can't have frames, we should just treat it as if the user had specified no decorations; look at window.c:recalc_window_features() for similar.
The problem here is that we get FRAME_TYPE_LAST even though frame_exists is set to TRUE, and then get_frame_style does not return a style for FRAME_TYPE_LAST. And the later code assumes that when frame_exist is TRUE, style will be non-NULL. It is a local problem in this function, and my patch fixes the crash that is a consequence. I don't know if it is ugly or not. If it is, somebody who knows mutter code better will have to come up with a less ugly fix.
Review of attachment 195629 [details] [review]: The problem here seems to be that the idea of "what types are decorated" is out of sync between recalc_window_features() and meta_window_get_frame_type() - so we get this case where META_CORE_WINDOW_HAS_FRAME => true, and META_CORE_GET_FRAME_TYPE => FRAME_TYPE_LAST. Think there's an easy fix to make recalc_window_features() just call meta_window_get_frame_type() to avoid duplicate bits of code that have to be in sync.
Created attachment 199224 [details] [review] window.c: use a consistent mapping from frame_type => decorated If a window had a type hint intended for override-redirect windows like NOTIFICATION, we ended up with a window that was decorated but with a frame type of FRAME_TYPE_LAST, causing assertion failures. Fix this by making recalc_window_features() just call meta_window_get_frame_type().
Attachment 199224 [details] pushed as f94f008 - window.c: use a consistent mapping from frame_type => decorated