Re: XShm change



On Mon, 7 Dec 1998, Owen Taylor wrote:

> 
> I've made a small change in handling shared memory images
> in GDK ... instead of the sequence:
> 
>  XShmCreateImage ()
>  shmget ()
>  shmat ()
>  shmctl (x_shm_info->shmid, IPC_RMID, 0);
>  XShmAttach (),
> 
> I've changed it to do:
> 
>  XShmCreateImage ()
>  shmget ()
>  shmat ()
>  XShmAttach (),
>  shmctl (x_shm_info->shmid, IPC_RMID, 0);
> 
> Jamie Zawinski pointed out to me that xscreensaver does it
> the latter way, and it apparently works everywhere. 
> 
> (The difference is that X doesn't need to attach to a segment
>  that has already been destroyed)
> 
> So, I've made the shmctl() unconditional, and ignored
> the results of the current configure test.
> 
> If people test this out, and it does in fact work everywhere, 
> then I'll remove the configure test and also remove the
> signal handlers that GTK+ installs to clean up after 
> left-over shared memory segments.

this change should be ok, at least for the systems that gtk and gimp
have been tested so far. the configure test only checks whether the
current system supports subsequent attaches after a shmctl(, IPC_RMID,),
which is not required for gdkimage.c actually.
note however, that the configure check cannot be avoided in the gimp code,
because the ability to attach to shm segments at a later point needs to be
preserved for plugins (and thus gimp needs to also handle shm segments in
its signal handlers).

> 
> Regards,
>                                         Owen
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]