present: 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:
Enrico Weigelt, metux IT consult 2024-09-20 15:30:16 +02:00
parent 2494b55db2
commit afa1352985
2 changed files with 5 additions and 12 deletions

View File

@ -165,7 +165,6 @@ struct present_screen_priv {
ScreenPtr pScreen; ScreenPtr pScreen;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify; ConfigNotifyProcPtr ConfigNotify;
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
present_vblank_ptr flip_pending; present_vblank_ptr flip_pending;

View File

@ -86,10 +86,9 @@ present_free_window_vblank(WindowPtr window)
/* /*
* Hook the close window function to clean up our window private * Hook the close window function to clean up our window private
*/ */
static Bool static void
present_destroy_window(WindowPtr window) present_destroy_window(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{ {
Bool ret;
ScreenPtr screen = window->drawable.pScreen; ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen); present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window); present_window_priv_ptr window_priv = present_window_priv(window);
@ -112,13 +111,6 @@ present_destroy_window(WindowPtr window)
free(window_priv); free(window_priv);
} }
unwrap(screen_priv, screen, DestroyWindow);
if (screen->DestroyWindow)
ret = screen->DestroyWindow (window);
else
ret = TRUE;
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
return ret;
} }
/* /*
@ -183,7 +175,9 @@ present_screen_priv_init(ScreenPtr screen)
return NULL; return NULL;
wrap(screen_priv, screen, CloseScreen, present_close_screen); wrap(screen_priv, screen, CloseScreen, present_close_screen);
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
dixScreenHookWindowDestroy(screen, present_destroy_window);
wrap(screen_priv, screen, ConfigNotify, present_config_notify); wrap(screen_priv, screen, ConfigNotify, present_config_notify);
wrap(screen_priv, screen, ClipNotify, present_clip_notify); wrap(screen_priv, screen, ClipNotify, present_clip_notify);