metacity r3751 - in trunk: . src/compositor
- From: tthurman svn gnome org
- To: svn-commits-list gnome org
- Subject: metacity r3751 - in trunk: . src/compositor
- Date: Thu, 5 Jun 2008 01:54:25 +0000 (UTC)
Author: tthurman
Date: Thu Jun 5 01:54:25 2008
New Revision: 3751
URL: http://svn.gnome.org/viewvc/metacity?rev=3751&view=rev
Log:
2008-06-05 Thomas Thurman <tthurman gnome org>
* src/compositor/compositor-xrender.c (paint_root, destroy_win,
create_root_buffer, paint_windows, repair_screen, window_has_shadow,
xrender_set_active_window, paint_dock_shadows, unmap_win, restack_win,
make_shadow, resize_win, process_property_notify, free_win,
process_configure_notify, process_circulate_notify, add_damage):
defensive programming; check meta_screen_get_compositor_data()
throughout in case it returns NULL. In particular, when this
happened in a certain situation in xrender_set_active_window
this caused a segfault; refs #530702 (and LP#178953 has more data)
but this doesn't close them.
Modified:
trunk/ChangeLog
trunk/src/compositor/compositor-xrender.c
Modified: trunk/src/compositor/compositor-xrender.c
==============================================================================
--- trunk/src/compositor/compositor-xrender.c (original)
+++ trunk/src/compositor/compositor-xrender.c Thu Jun 5 01:54:25 2008
@@ -478,18 +478,28 @@
Display *xdisplay = meta_display_get_xdisplay (display);
XImage *ximage;
guchar *data;
- shadow *shad = info->shadows[shadow_type];
- int msize = shad->gaussian_map->size;
+ shadow *shad;
+ int msize;
int ylimit, xlimit;
- int swidth = width + msize;
- int sheight = height + msize;
- int centre = msize / 2;
+ int swidth, sheight;
+ int centre;
int x, y;
guchar d;
int x_diff;
int opacity_int = (int)(opacity * 25);
int screen_number = meta_screen_get_screen_number (screen);
+ if (info==NULL)
+ {
+ return NULL;
+ }
+
+ shad = info->shadows[shadow_type];
+ msize = shad->gaussian_map->size;
+ swidth = width + msize;
+ sheight = height + msize;
+ centre = msize / 2;
+
data = g_malloc (swidth * sheight * sizeof (guchar));
ximage = XCreateImage (xdisplay, DefaultVisual (xdisplay, screen_number),
@@ -824,6 +834,11 @@
Visual *visual;
int depth, screen_width, screen_height, screen_number;
+ if (info == NULL)
+ {
+ return None;
+ }
+
meta_screen_get_size (screen, &screen_width, &screen_height);
screen_number = meta_screen_get_screen_number (screen);
visual = DefaultVisual (xdisplay, screen_number);
@@ -851,6 +866,11 @@
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
int width, height;
+ if (info == NULL)
+ {
+ return;
+ }
+
g_return_if_fail (root_buffer != None);
if (info->root_tile == None)
@@ -869,7 +889,7 @@
{
MetaCompScreen *info = meta_screen_get_compositor_data (cw->screen);
- if (info->have_shadows == FALSE)
+ if (info == NULL || info->have_shadows == FALSE)
return FALSE;
/* Always put a shadow around windows with a frame - This should override
@@ -1070,6 +1090,11 @@
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
GSList *d;
+ if (info == NULL)
+ {
+ return;
+ }
+
for (d = info->dock_windows; d; d = d->next)
{
MetaCompWindow *cw = d->data;
@@ -1109,6 +1134,11 @@
MetaCompWindow *cw;
XserverRegion paint_region, desktop_region;
+ if (info == NULL)
+ {
+ return;
+ }
+
meta_screen_get_size (screen, &screen_width, &screen_height);
screen_number = meta_screen_get_screen_number (screen);
xroot = meta_screen_get_xroot (screen);
@@ -1364,7 +1394,7 @@
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
- if (info->all_damage != None)
+ if (info!=NULL && info->all_damage != None)
{
meta_error_trap_push (display);
paint_all (screen, info->all_damage);
@@ -1436,7 +1466,7 @@
/* dump_xserver_region ("add_damage", display, damage); */
- if (info->all_damage)
+ if (info != NULL && info->all_damage)
{
XFixesUnionRegion (xdisplay, info->all_damage, info->all_damage, damage);
XFixesDestroyRegion (xdisplay, damage);
@@ -1579,7 +1609,7 @@
/* The window may not have been added to the list in this case,
but we can check anyway */
- if (cw->type == META_COMP_WINDOW_DOCK)
+ if (info!=NULL && cw->type == META_COMP_WINDOW_DOCK)
info->dock_windows = g_slist_remove (info->dock_windows, cw);
g_free (cw);
@@ -1626,7 +1656,7 @@
MetaCompWindow *cw = find_window_for_screen (screen, id);
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
- if (cw == NULL)
+ if (cw == NULL || info == NULL)
{
return;
}
@@ -1878,8 +1908,11 @@
}
info = meta_screen_get_compositor_data (screen);
- info->windows = g_list_remove (info->windows, (gconstpointer) cw);
- g_hash_table_remove (info->windows_by_xid, (gpointer) xwindow);
+ if (info != NULL)
+ {
+ info->windows = g_list_remove (info->windows, (gconstpointer) cw);
+ g_hash_table_remove (info->windows_by_xid, (gpointer) xwindow);
+ }
free_win (cw, TRUE);
}
@@ -1896,6 +1929,11 @@
screen = cw->screen;
info = meta_screen_get_compositor_data (screen);
+ if (info == NULL)
+ {
+ return;
+ }
+
sibling = g_list_find (info->windows, (gconstpointer) cw);
next = g_list_next (sibling);
previous_above = None;
@@ -2045,7 +2083,10 @@
dump_xserver_region ("resize_win", display, damage);
add_damage (screen, damage);
- info->clip_changed = TRUE;
+ if (info != NULL)
+ {
+ info->clip_changed = TRUE;
+ }
}
/* event processors must all be called with an error trap in place */
@@ -2075,7 +2116,10 @@
above = None;
restack_win (cw, above);
- info->clip_changed = TRUE;
+ if (info != NULL)
+ {
+ info->clip_changed = TRUE;
+ }
#ifdef USE_IDLE_REPAINT
add_repair (compositor->display);
@@ -2133,7 +2177,7 @@
return;
info = meta_screen_get_compositor_data (screen);
- if (info->root_buffer)
+ if (info != NULL && info->root_buffer)
{
XRenderFreePicture (xdisplay, info->root_buffer);
info->root_buffer = None;
@@ -2167,7 +2211,7 @@
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
Window xroot = meta_screen_get_xroot (screen);
- if (info->root_tile)
+ if (info != NULL && info->root_tile)
{
XClearArea (xdisplay, xroot, 0, 0, 0, 0, TRUE);
XRenderFreePicture (xdisplay, info->root_tile);
@@ -2809,8 +2853,8 @@
MetaDisplay *display;
Display *xdisplay;
MetaCompWindow *old_focus = NULL, *new_focus = NULL;
- MetaCompScreen *info;
- MetaWindow *old_focus_win;
+ MetaCompScreen *info = NULL;
+ MetaWindow *old_focus_win = NULL;
if (compositor == NULL)
return;
@@ -2818,7 +2862,11 @@
display = xrc->display;
xdisplay = meta_display_get_xdisplay (display);
info = meta_screen_get_compositor_data (screen);
- old_focus_win = info->focus_window;
+
+ if (info != NULL)
+ {
+ old_focus_win = info->focus_window;
+ }
if (old_focus_win)
{
@@ -2837,7 +2885,11 @@
meta_window_get_xwindow (window));
}
- info->focus_window = window;
+ if (info != NULL)
+ {
+ info->focus_window = window;
+ }
+
if (old_focus)
{
XserverRegion damage;
@@ -2877,8 +2929,11 @@
dump_xserver_region ("resize_win", display, damage);
add_damage (screen, damage);
-
- info->clip_changed = TRUE;
+
+ if (info != NULL)
+ {
+ info->clip_changed = TRUE;
+ }
}
}
@@ -2919,7 +2974,10 @@
dump_xserver_region ("resize_win", display, damage);
add_damage (screen, damage);
- info->clip_changed = TRUE;
+ if (info != NULL)
+ {
+ info->clip_changed = TRUE;
+ }
}
#ifdef USE_IDLE_REPAINT
add_repair (display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]