summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorThomas Thurman <tthurman@gnome.org>2008-03-29 21:29:57 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-03-29 21:29:57 +0000
commit6a586e892940b34ee02ff94732fa3d9abe61cbab (patch)
tree3d5639440c6c9644b939bc1c4a34f999c0131429 /src/ui
parent58ef1592a5d9d2a0577da977cb27f417032718cf (diff)
downloadmetacity-6a586e892940b34ee02ff94732fa3d9abe61cbab.tar.gz
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
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/preview-widget.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index c0ac6d74..4d2f9a2e 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -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);