summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1998-12-07 19:03:10 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-12-07 19:03:10 +0000
commitd1045b68761137114109cd3c786e0f35f8d560c4 (patch)
treeb0cf8b906f5b56afde5e6d2e67fb21fee91948e7 /gdk
parent139e3cd47da5a613a858d21e7baf75fd953af779 (diff)
downloadgtk+-d1045b68761137114109cd3c786e0f35f8d560c4.tar.gz
Use IPC_RMID _after_ doing XShmAttach. This should work everywhere, and
Mon Dec 7 13:38:06 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdkimage.c (gdk_image_new): Use IPC_RMID _after_ doing XShmAttach. This should work everywhere, and avoid the need for signal handlers or configure checks.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdkimage.c14
-rw-r--r--gdk/x11/gdkimage-x11.c14
2 files changed, 16 insertions, 12 deletions
diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c
index 8e62fef664..5d48182d93 100644
--- a/gdk/gdkimage.c
+++ b/gdk/gdkimage.c
@@ -235,11 +235,6 @@ gdk_image_new (GdkImageType type,
return NULL;
}
-#ifdef IPC_RMID_DEFERRED_RELEASE
- if (x_shm_info->shmaddr != (char*) -1)
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-#endif
-
gdk_error_code = 0;
gdk_error_warnings = 0;
@@ -260,6 +255,14 @@ gdk_image_new (GdkImageType type,
gdk_use_xshm = False;
return NULL;
}
+
+ /* We mark the segment as destroyed so that when
+ * the last process detaches, it will be deleted.
+ * There is a small possibility of leaking if
+ * we die in XShmAttach. In theory, a signal handler
+ * could be set up.
+ */
+ shmctl (x_shm_info->shmid, IPC_RMID, 0);
if (image)
image_list = g_list_prepend (image_list, image);
@@ -417,7 +420,6 @@ gdk_image_destroy (GdkImage *image)
x_shm_info = private->x_shm_info;
shmdt (x_shm_info->shmaddr);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
g_free (private->x_shm_info);
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
index 8e62fef664..5d48182d93 100644
--- a/gdk/x11/gdkimage-x11.c
+++ b/gdk/x11/gdkimage-x11.c
@@ -235,11 +235,6 @@ gdk_image_new (GdkImageType type,
return NULL;
}
-#ifdef IPC_RMID_DEFERRED_RELEASE
- if (x_shm_info->shmaddr != (char*) -1)
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-#endif
-
gdk_error_code = 0;
gdk_error_warnings = 0;
@@ -260,6 +255,14 @@ gdk_image_new (GdkImageType type,
gdk_use_xshm = False;
return NULL;
}
+
+ /* We mark the segment as destroyed so that when
+ * the last process detaches, it will be deleted.
+ * There is a small possibility of leaking if
+ * we die in XShmAttach. In theory, a signal handler
+ * could be set up.
+ */
+ shmctl (x_shm_info->shmid, IPC_RMID, 0);
if (image)
image_list = g_list_prepend (image_list, image);
@@ -417,7 +420,6 @@ gdk_image_destroy (GdkImage *image)
x_shm_info = private->x_shm_info;
shmdt (x_shm_info->shmaddr);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
g_free (private->x_shm_info);