metacity r3784 - in branches/gnome-2-22: . src/core



Author: tthurman
Date: Fri Jul 11 02:31:18 2008
New Revision: 3784
URL: http://svn.gnome.org/viewvc/metacity?rev=3784&view=rev

Log:
2008-07-10  Thomas Thurman  <tthurman gnome org>

        * src/core/compositor.c:  Add checks for the compositor being null.
        Backporting r3751 from 2.23.  Closes #530702.



Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/src/core/compositor.c

Modified: branches/gnome-2-22/src/core/compositor.c
==============================================================================
--- branches/gnome-2-22/src/core/compositor.c	(original)
+++ branches/gnome-2-22/src/core/compositor.c	Fri Jul 11 02:31:18 2008
@@ -406,16 +406,23 @@
   MetaCompScreen *info = screen->compositor_data;
   XImage *ximage;
   guchar *data;
-  int msize = info->gaussian_map->size;
+  int msize, swidth, sheight, centre;
   int ylimit, xlimit;
-  int swidth = width + msize;
-  int sheight = height + msize;
-  int centre = msize / 2;
   int x, y;
   guchar d;
   int x_diff;
   int opacity_int = (int)(opacity * 25);
 
+  if (info==NULL)
+    {
+      return NULL;
+    }
+
+  msize = info->gaussian_map->size;
+  swidth = width + msize;
+  sheight = height + msize;
+  centre = msize/2;
+
   data = g_malloc (swidth * sheight * sizeof (guchar));
 
   ximage = XCreateImage (display->xdisplay, 
@@ -727,6 +734,11 @@
   Visual *visual;
   int depth, screen_width, screen_height, screen_number;
 
+  if (info==NULL)
+    {
+      return None;
+    }
+
   screen_width = screen->rect.width;
   screen_height = screen->rect.height;
   screen_number = screen->number;
@@ -771,6 +783,11 @@
 static gboolean
 window_has_shadow (MetaCompWindow *cw)
 {
+  if ((MetaCompScreen *)cw->screen->compositor_data==NULL)
+    {
+      return FALSE;
+    }
+
   if (((MetaCompScreen *)cw->screen->compositor_data)->have_shadows == FALSE) 
     return FALSE;
 
@@ -948,6 +965,11 @@
   MetaCompScreen *info = screen->compositor_data;
   GSList *d;
 
+  if (info==NULL)
+    {
+      return;
+    }
+
   for (d = info->dock_windows; d; d = d->next) 
     {
       MetaCompWindow *cw = d->data;
@@ -987,6 +1009,11 @@
   MetaCompWindow *cw;
   XserverRegion paint_region, desktop_region;
 
+  if (info==NULL)
+    {
+      return;
+    }
+
   screen_width = screen->rect.width;
   screen_height = screen->rect.height;
   screen_number = screen->number;
@@ -1242,6 +1269,11 @@
   MetaCompScreen *info = screen->compositor_data;
   MetaDisplay *display = screen->display;
 
+  if (info==NULL)
+    {
+      return;
+    }
+
   if (info->all_damage != None) 
     {
       meta_error_trap_push (display);
@@ -1310,6 +1342,11 @@
   MetaDisplay *display = screen->display;
   MetaCompScreen *info = screen->compositor_data;
 
+  if (info==NULL)
+    {
+      return;
+    }
+
 //  dump_xserver_region ("add_damage", display, damage);
 
   if (info->all_damage) 
@@ -1451,7 +1488,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);
@@ -1497,7 +1534,7 @@
   MetaCompWindow *cw = find_window_for_screen (screen, id);
   MetaCompScreen *info = screen->compositor_data;
 
-  if (cw == NULL) 
+  if (cw == NULL || info == NULL)
     {
       return;
     }
@@ -1730,9 +1767,13 @@
     }
   
   info = screen->compositor_data;
-  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);
 }
 
@@ -1748,6 +1789,11 @@
   screen = cw->screen;
   info = screen->compositor_data;
 
+  if (info==NULL)
+    {
+      return;
+    }
+
   sibling = g_list_find (info->windows, (gconstpointer) cw);
   next = g_list_next (sibling);
   previous_above = None;
@@ -1903,7 +1949,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 */
@@ -1933,7 +1982,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);
@@ -1987,6 +2039,12 @@
         return;
 
       info = screen->compositor_data;
+
+      if (info==NULL)
+        {
+          return;
+        }
+
       if (info->root_buffer)
         {
           XRenderFreePicture (display->xdisplay, info->root_buffer);
@@ -2018,7 +2076,7 @@
           if (screen)
             {
               MetaCompScreen *info = screen->compositor_data;
-              if (info->root_tile)
+              if (info!=NULL && info->root_tile)
                 {
                   XClearArea (display->xdisplay, screen->xroot,
                               0, 0, 0, 0, TRUE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]