prevent null dereference if the theme was invalid, which caused crashes in

2008-03-29  Thomas Thurman  <tthurman@gnome.org>

        * src/ui/preview-widget.c (meta_preview_get_clip_region):
        prevent null dereference if the theme was invalid, which
        caused crashes in gnome-appearance-properties.  No GNOME
        bug number, but I believe this is a fix for Launchpad bug
        #199402 and its many duplicates.


svn path=/trunk/; revision=3668
This commit is contained in:
Thomas Thurman 2008-03-29 21:29:57 +00:00 committed by Thomas James Alexander Thurman
parent 58ef1592a5
commit 6a586e8929
2 changed files with 21 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2008-03-29 Thomas Thurman <tthurman@gnome.org>
* src/ui/preview-widget.c (meta_preview_get_clip_region):
prevent null dereference if the theme was invalid, which
caused crashes in gnome-appearance-properties. No GNOME
bug number, but I believe this is a fix for Launchpad bug
#199402 and its many duplicates.
2008-03-28 Owen Taylor <otaylor@redhat.com>
* src/core/window.c (meta_window_new_with_attrs): Don't

View File

@ -478,6 +478,19 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
flags = (META_PREVIEW (preview)->flags);
window_xregion = gdk_region_new ();
xrect.x = 0;
xrect.y = 0;
xrect.width = new_window_width;
xrect.height = new_window_height;
gdk_region_union_with_rect (window_xregion, &xrect);
if (preview->theme == NULL)
return window_xregion;
/* Otherwise, we do have a theme, so calculate the corners */
frame_style = meta_theme_get_frame_style (preview->theme,
META_FRAME_TYPE_NORMAL, flags);
@ -558,14 +571,6 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
}
}
window_xregion = gdk_region_new ();
xrect.x = 0;
xrect.y = 0;
xrect.width = new_window_width;
xrect.height = new_window_height;
gdk_region_union_with_rect (window_xregion, &xrect);
gdk_region_subtract (window_xregion, corners_xregion);
gdk_region_destroy (corners_xregion);