diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-08-23 17:11:39 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-08-24 10:23:26 +0200 |
commit | 7c7e3efff31a8c225bb7029d08675aa617635a95 (patch) | |
tree | b9e10a35e38101ee6d34db48d22c3177f8e80dc5 /client | |
parent | 7c61dfee893da1ea1ee48aa8590ffb52afa573b8 (diff) | |
download | spice-7c7e3efff31a8c225bb7029d08675aa617635a95.tar.gz spice-7c7e3efff31a8c225bb7029d08675aa617635a95.tar.xz spice-7c7e3efff31a8c225bb7029d08675aa617635a95.zip |
client: Don't leak xshm segments
Diffstat (limited to 'client')
-rw-r--r-- | client/x11/platform.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 1b54bc39..f80f0dcf 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -277,6 +277,14 @@ XImage *XPlatform::create_x_shm_image(RedDrawable::Format format, goto err2; } + /* Ensure the xserver has attached the xshm segment */ + XSync (XPlatform::get_display(), False); + + /* Mark segment as released so that it will be destroyed when + the xserver releases the segment. This way we won't leak + the segment if the client crashes. */ + shmctl(shminfo->shmid, IPC_RMID, 0); + image->data = (char *)shminfo->shmaddr; *shminfo_out = shminfo; |