summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-04-18 18:28:19 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-04-18 18:28:19 +0000
commit6cff7051b16d99178c5320592e96c757597835e4 (patch)
tree6aabc47ef5228d44c3a95b3a55cee06281200ac7 /gdk
parent60b6a010e931aaaf97d723c893068381a421f0a0 (diff)
downloadgtk+-6cff7051b16d99178c5320592e96c757597835e4.tar.gz
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.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdkwindow.c4
-rw-r--r--gdk/gdkwindow.h3
-rw-r--r--gdk/x11/gdkimage-x11.c22
3 files changed, 18 insertions, 11 deletions
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 1e6ec4bcee..37b3354d0b 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -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;
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 2c8d6bab1c..9a6d4c0155 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -180,7 +180,8 @@ struct _GdkWindowAttr
gboolean override_redirect;
};
-struct _GdkGeometry {
+struct _GdkGeometry
+{
gint min_width;
gint min_height;
gint max_width;
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
index c54441c17b..eb116f7488 100644
--- a/gdk/x11/gdkimage-x11.c
+++ b/gdk/x11/gdkimage-x11.c
@@ -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;