The shared memory segment created as the Xephyr screen buffer was
not being removed, and so would persist even after the server exits.

https://bugs.freedesktop.org/show_bug.cgi?id=47510

Signed-off-by: Alex Plotnick <[email protected]>
---
The first hunk also fixes a comment typo and a superfluous space in the
immediate vicinity. If anyone objects to these being in the same commit,
I can split it up, but it didn't seem worth it for such trivial tweaks.

 hw/kdrive/ephyr/hostx.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index ebe4e52..849e138 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -673,15 +673,14 @@ hostx_screen_init (EphyrScreenInfo screen,
   if (host_screen->ximg != NULL)
     {
       /* Free up the image data if previously used
-       * i.ie called by server reset
+       * i.e., called by server reset
        */
 
       if (HostX.have_shm)
        {
          XShmDetach(HostX.dpy, &host_screen->shminfo);
-         XDestroyImage (host_screen->ximg);
+         XDestroyImage(host_screen->ximg);
          shmdt(host_screen->shminfo.shmaddr);
-         shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
        }
       else
        {
@@ -710,15 +709,16 @@ hostx_screen_init (EphyrScreenInfo screen,
          EPHYR_DBG("Can't attach SHM Segment, falling back to plain XImages");
          HostX.have_shm = False;
          XDestroyImage(host_screen->ximg);
-         shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
        }
       else
        {
          EPHYR_DBG("SHM segment attached %p", host_screen->shminfo.shmaddr);
          host_screen->shminfo.readOnly = False;
          XShmAttach(HostX.dpy, &host_screen->shminfo);
+         XSync(HostX.dpy, False);
          shm_success = True;
        }
+      shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
     }
 
   if (!shm_success)
-- 
1.7.9.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to