Xext: shm: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new screen close notify hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									c5780c4c35
								
							
						
					
					
						commit
						4497e36cb5
					
				
							
								
								
									
										11
									
								
								Xext/shm.c
								
								
								
								
							
							
						
						
									
										11
									
								
								Xext/shm.c
								
								
								
								
							|  | @ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. | ||||||
| #include <X11/Xfuncproto.h> | #include <X11/Xfuncproto.h> | ||||||
| 
 | 
 | ||||||
| #include "dix/dix_priv.h" | #include "dix/dix_priv.h" | ||||||
|  | #include "dix/screen_hooks_priv.h" | ||||||
| #include "os/auth.h" | #include "os/auth.h" | ||||||
| #include "os/busfault.h" | #include "os/busfault.h" | ||||||
| #include "os/client_priv.h" | #include "os/client_priv.h" | ||||||
|  | @ -96,7 +97,6 @@ in this Software without prior written authorization from The Open Group. | ||||||
| #endif /* XINERAMA */ | #endif /* XINERAMA */ | ||||||
| 
 | 
 | ||||||
| typedef struct _ShmScrPrivateRec { | typedef struct _ShmScrPrivateRec { | ||||||
|     CloseScreenProcPtr CloseScreen; |  | ||||||
|     ShmFuncsPtr shmFuncs; |     ShmFuncsPtr shmFuncs; | ||||||
|     DestroyPixmapProcPtr destroyPixmap; |     DestroyPixmapProcPtr destroyPixmap; | ||||||
| } ShmScrPrivateRec; | } ShmScrPrivateRec; | ||||||
|  | @ -195,15 +195,13 @@ CheckForShmSyscall(void) | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| static Bool | static void | ||||||
| ShmCloseScreen(ScreenPtr pScreen) | ShmScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused) | ||||||
| { | { | ||||||
|     ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen); |     ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen); | ||||||
| 
 | 
 | ||||||
|     pScreen->CloseScreen = screen_priv->CloseScreen; |  | ||||||
|     dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL); |     dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL); | ||||||
|     free(screen_priv); |     free(screen_priv); | ||||||
|     return (*pScreen->CloseScreen) (pScreen); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static ShmScrPrivateRec * | static ShmScrPrivateRec * | ||||||
|  | @ -213,9 +211,8 @@ ShmInitScreenPriv(ScreenPtr pScreen) | ||||||
| 
 | 
 | ||||||
|     if (!screen_priv) { |     if (!screen_priv) { | ||||||
|         screen_priv = calloc(1, sizeof(ShmScrPrivateRec)); |         screen_priv = calloc(1, sizeof(ShmScrPrivateRec)); | ||||||
|         screen_priv->CloseScreen = pScreen->CloseScreen; |  | ||||||
|         dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv); |         dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv); | ||||||
|         pScreen->CloseScreen = ShmCloseScreen; |         dixScreenHookClose(pScreen, ShmScreenClose); | ||||||
|     } |     } | ||||||
|     return screen_priv; |     return screen_priv; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue