(!1714) render: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new window destructor hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									9590b34c8e
								
							
						
					
					
						commit
						e8aec6c563
					
				| 
						 | 
					@ -25,6 +25,7 @@
 | 
				
			||||||
#include <dix-config.h>
 | 
					#include <dix-config.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "dix/colormap_priv.h"
 | 
					#include "dix/colormap_priv.h"
 | 
				
			||||||
 | 
					#include "dix/screen_hooks_priv.h"
 | 
				
			||||||
#include "os/osdep.h"
 | 
					#include "os/osdep.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "misc.h"
 | 
					#include "misc.h"
 | 
				
			||||||
| 
						 | 
					@ -63,13 +64,10 @@ PictureWindowFormat(WindowPtr pWindow)
 | 
				
			||||||
                              WindowGetVisual(pWindow));
 | 
					                              WindowGetVisual(pWindow));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static void
 | 
				
			||||||
PictureDestroyWindow(WindowPtr pWindow)
 | 
					picture_window_destructor(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ScreenPtr pScreen = pWindow->drawable.pScreen;
 | 
					 | 
				
			||||||
    PicturePtr pPicture;
 | 
					    PicturePtr pPicture;
 | 
				
			||||||
    PictureScreenPtr ps = GetPictureScreen(pScreen);
 | 
					 | 
				
			||||||
    Bool ret;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while ((pPicture = GetPictureWindow(pWindow))) {
 | 
					    while ((pPicture = GetPictureWindow(pWindow))) {
 | 
				
			||||||
        SetPictureWindow(pWindow, pPicture->pNext);
 | 
					        SetPictureWindow(pWindow, pPicture->pNext);
 | 
				
			||||||
| 
						 | 
					@ -77,11 +75,6 @@ PictureDestroyWindow(WindowPtr pWindow)
 | 
				
			||||||
            FreeResource(pPicture->id, PictureType);
 | 
					            FreeResource(pPicture->id, PictureType);
 | 
				
			||||||
        FreePicture((void *) pPicture, pPicture->id);
 | 
					        FreePicture((void *) pPicture, pPicture->id);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    pScreen->DestroyWindow = ps->DestroyWindow;
 | 
					 | 
				
			||||||
    ret = (*pScreen->DestroyWindow) (pWindow);
 | 
					 | 
				
			||||||
    ps->DestroyWindow = pScreen->DestroyWindow;
 | 
					 | 
				
			||||||
    pScreen->DestroyWindow = PictureDestroyWindow;
 | 
					 | 
				
			||||||
    return ret;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
| 
						 | 
					@ -693,12 +686,12 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
 | 
				
			||||||
    ps->subpixel = SubPixelUnknown;
 | 
					    ps->subpixel = SubPixelUnknown;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ps->CloseScreen = pScreen->CloseScreen;
 | 
					    ps->CloseScreen = pScreen->CloseScreen;
 | 
				
			||||||
    ps->DestroyWindow = pScreen->DestroyWindow;
 | 
					 | 
				
			||||||
    ps->StoreColors = pScreen->StoreColors;
 | 
					    ps->StoreColors = pScreen->StoreColors;
 | 
				
			||||||
    pScreen->DestroyWindow = PictureDestroyWindow;
 | 
					 | 
				
			||||||
    pScreen->CloseScreen = PictureCloseScreen;
 | 
					    pScreen->CloseScreen = PictureCloseScreen;
 | 
				
			||||||
    pScreen->StoreColors = PictureStoreColors;
 | 
					    pScreen->StoreColors = PictureStoreColors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dixScreenHookWindowDestroy(pScreen, picture_window_destructor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!PictureSetDefaultFilters(pScreen)) {
 | 
					    if (!PictureSetDefaultFilters(pScreen)) {
 | 
				
			||||||
        PictureResetFilters(pScreen);
 | 
					        PictureResetFilters(pScreen);
 | 
				
			||||||
        SetPictureScreen(pScreen, 0);
 | 
					        SetPictureScreen(pScreen, 0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -294,7 +294,6 @@ typedef struct _PictureScreen {
 | 
				
			||||||
    GlyphsProcPtr Glyphs;       /* unused */
 | 
					    GlyphsProcPtr Glyphs;       /* unused */
 | 
				
			||||||
    CompositeRectsProcPtr CompositeRects;
 | 
					    CompositeRectsProcPtr CompositeRects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DestroyWindowProcPtr DestroyWindow;
 | 
					 | 
				
			||||||
    CloseScreenProcPtr CloseScreen;
 | 
					    CloseScreenProcPtr CloseScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    StoreColorsProcPtr StoreColors;
 | 
					    StoreColorsProcPtr StoreColors;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue