From 4ca68c30aac1a73dd5704dd9ac2371a86cb4fc70 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 28 Apr 2025 15:13:32 +0200 Subject: [PATCH] present: 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 --- present/present_priv.h | 1 - present/present_screen.c | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/present/present_priv.h b/present/present_priv.h index ba9d89434..dafe75d26 100644 --- a/present/present_priv.h +++ b/present/present_priv.h @@ -163,7 +163,6 @@ typedef void (*present_priv_flip_destroy_ptr)(ScreenPtr screen); struct present_screen_priv { ScreenPtr pScreen; - CloseScreenProcPtr CloseScreen; ConfigNotifyProcPtr ConfigNotify; ClipNotifyProcPtr ClipNotify; diff --git a/present/present_screen.c b/present/present_screen.c index 0f881c0c3..a72d51aab 100644 --- a/present/present_screen.c +++ b/present/present_screen.c @@ -54,18 +54,18 @@ present_get_window_priv(WindowPtr window, Bool create) /* * Hook the close screen function to clean up our screen private */ -static Bool -present_close_screen(ScreenPtr screen) +static void present_close_screen(CallbackListPtr *pcbl, ScreenPtr screen, void *unused) { present_screen_priv_ptr screen_priv = present_screen_priv(screen); + if (!screen_priv) + return; if (screen_priv->flip_destroy) screen_priv->flip_destroy(screen); - unwrap(screen_priv, screen, CloseScreen); - (*screen->CloseScreen) (screen); + dixScreenUnhookClose(screen, present_close_screen); + dixSetPrivate(&screen->devPrivates, &present_screen_private_key, NULL); free(screen_priv); - return TRUE; } /* @@ -176,9 +176,8 @@ present_screen_priv_init(ScreenPtr screen) if (!screen_priv) return NULL; - wrap(screen_priv, screen, CloseScreen, present_close_screen); - dixScreenHookWindowDestroy(screen, present_destroy_window); + dixScreenHookClose(screen, present_close_screen); wrap(screen_priv, screen, ConfigNotify, present_config_notify); wrap(screen_priv, screen, ClipNotify, present_clip_notify);