Rework composite overlay window code to fix several resource management bugs.

The composite overlay window code had several misunderstandings of the
workings of the X server, in particular error handling paths would often
double-free objects. Clean all of this up by using resource destruction as
the sole mechanism for freeing resource-based objects.
This commit is contained in:
Keith Packard
2008-05-04 21:52:58 -07:00
parent 6c1accce87
commit efa65a0317
5 changed files with 206 additions and 184 deletions

View File

@@ -155,6 +155,7 @@ typedef struct _CompScreen {
VisualID *alternateVisuals;
WindowPtr pOverlayWin;
Window overlayWid;
CompOverlayClientPtr pOverlayClients;
} CompScreenRec, *CompScreenPtr;
@@ -172,6 +173,7 @@ extern DevPrivateKey CompSubwindowsPrivateKey;
extern RESTYPE CompositeClientWindowType;
extern RESTYPE CompositeClientSubwindowsType;
extern RESTYPE CompositeClientOverlayType;
/*
* compalloc.c
@@ -229,6 +231,25 @@ CompositeRegisterAlternateVisuals (ScreenPtr pScreen,
Bool
compScreenInit (ScreenPtr pScreen);
/*
* compoverlay.c
*/
void
compFreeOverlayClient (CompOverlayClientPtr pOcToDel);
CompOverlayClientPtr
compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
CompOverlayClientPtr
compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
Bool
compCreateOverlayWindow (ScreenPtr pScreen);
void
compDestroyOverlayWindow (ScreenPtr pScreen);
/*
* compwindow.c
*/
@@ -292,9 +313,6 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
compWindowUpdate (WindowPtr pWin);
void
deleteCompOverlayClientsForScreen (ScreenPtr pScreen);
WindowPtr
CompositeRealChildHead (WindowPtr pWin);