Try changing mode on shm segments to 0600. We'll see who complains.
Wed Apr 18 14:23:14 2001 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkimage-x11.c (gdk_image_new): Try changing mode on shm segments to 0600. We'll see who complains. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Call _gdk_windowing_window_destroy() AFTER recursing through children. * tests/Makefile.am (noinst_PROGRAMS): Build testsocket, testsocket_child on X. * tests/testsocket[_child].c: Fix uses of gtk_window_get_default_accel_group(). [ Merge patch from Ramiro Estrugo <ramiro@eazel.com> from gtk-1-2 ] * gdk/gdkimage.c: (gdk_image_get): Deal with the possibility that XGetImage() might return NULL. Allocate the GdkImagePrivate structure only after XGetImage() succeeds in order not to dereference a NULL ximage pointer. This prevents a core dump when XGetImage() fails - which is unlikely, but can happen due to race conditions accessing the geometries of drawables. An x error will still be triggered, but the gdk image wrapper at least wont seg fault.
This commit is contained in:
		| @ -295,8 +295,6 @@ _gdk_window_destroy_hierarchy (GdkWindow *window, | ||||
| 	  private->state |= GDK_WINDOW_STATE_WITHDRAWN; | ||||
| 	  private->destroyed = TRUE; | ||||
| 	   | ||||
| 	  _gdk_windowing_window_destroy (window, recursing, foreign_destroy); | ||||
|  | ||||
| 	  if (private->parent) | ||||
| 	    { | ||||
| 	      GdkWindowObject *parent_private = (GdkWindowObject *)private->parent; | ||||
| @ -333,6 +331,8 @@ _gdk_window_destroy_hierarchy (GdkWindow *window, | ||||
| 	      g_list_free (children); | ||||
| 	    } | ||||
| 	   | ||||
| 	  _gdk_windowing_window_destroy (window, recursing, foreign_destroy); | ||||
|  | ||||
| 	  if (private->filters) | ||||
| 	    { | ||||
| 	      tmp = private->filters; | ||||
|  | ||||
| @ -180,7 +180,8 @@ struct _GdkWindowAttr | ||||
|   gboolean override_redirect; | ||||
| }; | ||||
|  | ||||
| struct _GdkGeometry { | ||||
| struct _GdkGeometry | ||||
| { | ||||
|   gint min_width; | ||||
|   gint min_height; | ||||
|   gint max_width; | ||||
|  | ||||
| @ -256,13 +256,13 @@ gdk_image_new (GdkImageType  type, | ||||
|  | ||||
| 	      x_shm_info->shmid = shmget (IPC_PRIVATE, | ||||
| 					  private->ximage->bytes_per_line * private->ximage->height, | ||||
| 					  IPC_CREAT | 0777); | ||||
| 					  IPC_CREAT | 0600); | ||||
|  | ||||
| 	      if (x_shm_info->shmid == -1) | ||||
| 		{ | ||||
| 		  /* EINVAL indicates, most likely, that the segment we asked for | ||||
| 		   * is bigger than SHMMAX, so we don't treat it as a permanently | ||||
| 		   * fatal error. ENOSPC and ENOMEM may also indicate this, but | ||||
| 		   * is bigger than SHMMAX, so we don't treat it as a permanent | ||||
| 		   * error. ENOSPC and ENOMEM may also indicate this, but | ||||
| 		   * more likely are permanent errors. | ||||
| 		   */ | ||||
| 		  if (errno != EINVAL) | ||||
| @ -381,7 +381,8 @@ _gdk_x11_get_image (GdkDrawable    *drawable, | ||||
|   GdkImagePrivateX11 *private; | ||||
|   GdkDrawableImplX11 *impl; | ||||
|   GdkVisual *visual; | ||||
|    | ||||
|   XImage *ximage; | ||||
|   | ||||
|   g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_X11 (drawable), NULL); | ||||
|  | ||||
|   visual = gdk_drawable_get_visual (drawable); | ||||
| @ -398,14 +399,19 @@ _gdk_x11_get_image (GdkDrawable    *drawable, | ||||
|    | ||||
|   impl = GDK_DRAWABLE_IMPL_X11 (drawable); | ||||
|    | ||||
|   ximage = XGetImage (impl->xdisplay, | ||||
| 		      impl->xid, | ||||
| 		      x, y, width, height, | ||||
| 		      AllPlanes, ZPixmap); | ||||
|  | ||||
|   if (!ximage) | ||||
|     return NULL; | ||||
|  | ||||
|   image = g_object_new (gdk_image_get_type (), NULL); | ||||
|   private = PRIVATE_DATA (image); | ||||
|  | ||||
|   private->xdisplay = gdk_display; | ||||
|   private->ximage = XGetImage (private->xdisplay, | ||||
|                                impl->xid, | ||||
| 			       x, y, width, height, | ||||
| 			       AllPlanes, ZPixmap); | ||||
|   private->ximage = ximage; | ||||
|  | ||||
|   image->type = GDK_IMAGE_NORMAL; | ||||
|   image->visual = visual; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Owen Taylor
					Owen Taylor