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)