[PATCH 2/3] dbe: Cleanup in CloseScreen hook not ext CloseDown
Robert Bragg
robert at sixbynine.org
Thu Jan 12 10:16:08 PST 2012
From: Robert Bragg <robert at linux.intel.com>
Instead of registering an extension CloseDownProc when adding the dbe
extension this patch hooks into pScreen->CloseScreen so that the chain
of pScreen->DestroyWindow hooks remains valid until all windows have
been destroyed. Previously it was possible for DbeResetProc to be called
before the root window had been destroyed and the unwrapping of
pScreen->DestroyWindow would clobber the chain of callbacks.
This is needed for xwayland to be able to know when the root window is
destroyed so it can unredirect root sub-windows.
---
dbe/dbe.c | 40 ++++++++++++++++++++--------------------
dbe/dbestruct.h | 1 +
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 51bbdc6..2f12907 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -1406,7 +1406,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
/******************************************************************************
*
- * DBE DIX Procedure: DbeResetProc
+ * DBE DIX Procedure: DbeCloseScreen
*
* Description:
*
@@ -1415,30 +1415,27 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
* other tasks related to shutting down the extension.
*
*****************************************************************************/
-static void
-DbeResetProc(ExtensionEntry *extEntry)
+static Bool
+DbeCloseScreen (int i, ScreenPtr pScreen)
{
- int i;
- ScreenPtr pScreen;
- DbeScreenPrivPtr pDbeScreenPriv;
-
- for (i = 0; i < screenInfo.numScreens; i++)
+ DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+
+ if (pDbeScreenPriv)
{
- pScreen = screenInfo.screens[i];
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+ /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit().*/
+ pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
- if (pDbeScreenPriv)
- {
- /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit().*/
- pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
+ /* Unwrap CloseScreen, which was wrapped in DbeExtensionInit().*/
+ pScreen->CloseScreen = pDbeScreenPriv->CloseScreen;
- if (pDbeScreenPriv->ResetProc)
- (*pDbeScreenPriv->ResetProc)(pScreen);
+ if (pDbeScreenPriv->ResetProc)
+ (*pDbeScreenPriv->ResetProc)(pScreen);
- free(pDbeScreenPriv);
- }
+ free(pDbeScreenPriv);
}
-} /* DbeResetProc() */
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+} /* DbeCloseScreen */
/******************************************************************************
@@ -1616,6 +1613,9 @@ DbeExtensionInit(void)
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
+
+ pDbeScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = DbeCloseScreen;
}
else
{
@@ -1648,7 +1648,7 @@ DbeExtensionInit(void)
/* Now add the extension. */
extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
- DbeResetProc, StandardMinorOpcode);
+ NULL, StandardMinorOpcode);
dbeErrorBase = extEntry->errorBase;
SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer);
diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h
index 9c383ce..f64e8d8 100644
--- a/dbe/dbestruct.h
+++ b/dbe/dbestruct.h
@@ -173,6 +173,7 @@ typedef struct _DbeScreenPrivRec
*/
PositionWindowProcPtr PositionWindow;
DestroyWindowProcPtr DestroyWindow;
+ CloseScreenProcPtr CloseScreen;
/* Per-screen DIX routines */
Bool (*SetupBackgroundPainter)(
--
1.7.7.5
More information about the wayland-devel
mailing list