[PATCH 1/2] Ensure all resource types created have names registered

Alan Coopersmith alan.coopersmith at sun.com
Thu Dec 10 22:53:48 PST 2009


Calls RegisterResourceName to record the type name for
use by X-Resource, XACE/SELinux/XTsol, and DTrace.

Also cleaned up various bits of checking to see if CreateNewResourceType
failed, including several places where the result was |'ed with flag bits
before checking to see if it was 0.

Does not change ABI so is safe for applying to stable branches

Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
---
 Xext/mbuf.c                           |   10 +++++++++-
 Xext/panoramiX.c                      |   18 +++++++++++++-----
 Xext/saver.c                          |    4 ++++
 Xext/shape.c                          |    3 +++
 Xext/shm.c                            |    2 ++
 Xext/sleepuntil.c                     |    2 ++
 Xext/sync.c                           |   12 ++++++++++--
 Xext/xvdisp.c                         |    5 ++++-
 Xext/xvmain.c                         |   15 +++++++++++----
 Xext/xvmc.c                           |    4 ++++
 Xi/extinit.c                          |    2 ++
 composite/compext.c                   |    6 ++++++
 damageext/damageext.c                 |    3 +++
 dbe/dbe.c                             |   10 +++++++++-
 glx/glxext.c                          |    3 +++
 hw/dmx/glxProxy/glxext.c              |   11 +++++++++++
 hw/kdrive/ephyr/ephyrdriext.c         |    6 ++++++
 hw/xfree86/dixmods/extmod/xf86vmode.c |    2 ++
 hw/xfree86/dri/dri.c                  |    6 ++++++
 hw/xfree86/dri/xf86dri.c              |    4 ++++
 hw/xfree86/dri2/dri2ext.c             |    9 ++++++++-
 hw/xquartz/applewm.c                  |    3 +++
 hw/xquartz/xpr/dri.c                  |    6 +++++-
 hw/xwin/winwindowswm.c                |    3 +++
 mi/miarc.c                            |    2 ++
 randr/randr.c                         |    4 ++++
 record/record.c                       |    2 ++
 render/render.c                       |    4 ++++
 xfixes/cursor.c                       |    9 ++++++++-
 xfixes/region.c                       |    6 +++++-
 xfixes/select.c                       |    6 ++++++
 xkb/xkb.c                             |    7 ++++++-
 32 files changed, 170 insertions(+), 19 deletions(-)

diff --git a/Xext/mbuf.c b/Xext/mbuf.c
index 1f24974..51e927a 100644
--- a/Xext/mbuf.c
+++ b/Xext/mbuf.c
@@ -42,6 +42,8 @@ in this Software without prior written authorization from The Open Group.
 #include "opaque.h"
 #include "sleepuntil.h"
 #include "inputstr.h"
+#include "registry.h"
+
 #include <X11/extensions/multibufconst.h>
 #include <X11/extensions/multibufproto.h>
 
@@ -467,7 +469,7 @@ MultibufferExtensionInit()
      * create the resource types
      */
     MultibufferDrawableResType =
-	CreateNewResourceType(MultibufferDrawableDelete)|RC_DRAWABLE;
+	CreateNewResourceType(MultibufferDrawableDelete);
     MultibufferResType = CreateNewResourceType(MultibufferDelete);
     MultibuffersResType = CreateNewResourceType(MultibuffersDelete);
     OtherClientResType = CreateNewResourceType(OtherClientDelete);
@@ -479,6 +481,12 @@ MultibufferExtensionInit()
 				 ProcMultibufferDispatch, SProcMultibufferDispatch,
 				 MultibufferResetProc, StandardMinorOpcode)))
     {
+	MultibufferDrawableResType |= RC_DRAWABLE;
+	RegisterResourceName(MultibufferDrawableResType,
+			     "MultibufferDrawable");
+	RegisterResourceName(MultibufferResType, "MultibufferBuffer");
+	RegisterResourceName(MultibuffersResType, "MultibufferWindow");
+	RegisterResourceName(OtherClientResType, "MultibufferOtherClient");
 	MultibufferEventBase = extEntry->eventBase;
 	MultibufferErrorBase = extEntry->errorBase;
 	EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 4b7b07e..507eec2 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -52,6 +52,7 @@ Equipment Corporation.
 #include "globals.h"
 #include "servermd.h"
 #include "resource.h"
+#include "registry.h"
 #ifdef RENDER
 #include "picturestr.h"
 #endif
@@ -503,15 +504,22 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 	}
 
 	XRC_DRAWABLE = CreateNewResourceClass();
-	XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource) | 
-						XRC_DRAWABLE;
-	XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource) | 
-						XRC_DRAWABLE;
+	XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource);
+	XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource);
 	XRT_GC = CreateNewResourceType(XineramaDeleteResource);
 	XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource);
 
 	panoramiXGeneration = serverGeneration;
-	success = TRUE;
+	if (XRT_WINDOW && XRT_PIXMAP && XRT_GC && XRT_COLORMAP) {
+	    RegisterResourceName(XRT_WINDOW, "XineramaWindow");
+	    RegisterResourceName(XRT_PIXMAP, "XineramaPixmap");
+	    RegisterResourceName(XRT_GC, "XineramaGC");
+	    RegisterResourceName(XRT_COLORMAP, "XineramaColormap");
+
+	    XRT_WINDOW |= XRC_DRAWABLE;
+	    XRT_PIXMAP |= XRC_DRAWABLE;
+	    success = TRUE;
+	}
     }
 
     if (!success) {
diff --git a/Xext/saver.c b/Xext/saver.c
index 04e6497..5757f85 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -47,6 +47,7 @@ in this Software without prior written authorization from the X Consortium.
 #include "cursorstr.h"
 #include "colormapst.h"
 #include "xace.h"
+#include "registry.h"
 #ifdef PANORAMIX
 #include "panoramiX.h"
 #include "panoramiXsrv.h"
@@ -266,6 +267,9 @@ ScreenSaverExtensionInit(INITARGS)
 				 ProcScreenSaverDispatch, SProcScreenSaverDispatch,
 				 NULL, StandardMinorOpcode)))
     {
+	RegisterResourceName(AttrType, "SaverAttr");
+	RegisterResourceName(SaverEventType, "SaverEvent");
+	RegisterResourceName(SuspendType, "SaverSuspend");
 	ScreenSaverEventBase = extEntry->eventBase;
 	EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent;
     }
diff --git a/Xext/shape.c b/Xext/shape.c
index 700fe76..247f21b 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -40,6 +40,7 @@ in this Software without prior written authorization from The Open Group.
 #include "extnsionst.h"
 #include "dixstruct.h"
 #include "resource.h"
+#include "registry.h"
 #include "opaque.h"
 #include <X11/extensions/shapeproto.h>
 #include "regionstr.h"
@@ -134,6 +135,8 @@ ShapeExtensionInit(void)
 				 ProcShapeDispatch, SProcShapeDispatch,
 				 NULL, StandardMinorOpcode)))
     {
+	RegisterResourceName(ClientType, "ShapeClient");
+	RegisterResourceName(ShapeEventType, "ShapeEvent");
 	ShapeEventBase = extEntry->eventBase;
 	EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
     }
diff --git a/Xext/shm.c b/Xext/shm.c
index 9e462f2..589155d 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -52,6 +52,7 @@ in this Software without prior written authorization from The Open Group.
 #include "servermd.h"
 #include "shmint.h"
 #include "xace.h"
+#include "registry.h"
 #include <X11/extensions/shmproto.h>
 #include <X11/Xfuncproto.h>
 #include "protocol-versions.h"
@@ -283,6 +284,7 @@ ShmExtensionInit(INITARGS)
 				 ProcShmDispatch, SProcShmDispatch,
 				 ShmResetProc, StandardMinorOpcode)))
     {
+	RegisterResourceName(ShmSegType, "ShmSeg");
 	ShmReqCode = (unsigned char)extEntry->base;
 	ShmCompletionCode = extEntry->eventBase;
 	BadShmSegCode = extEntry->errorBase;
diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c
index 2616a5e..6b5964e 100644
--- a/Xext/sleepuntil.c
+++ b/Xext/sleepuntil.c
@@ -39,6 +39,7 @@ in this Software without prior written authorization from The Open Group.
 #include "dixstruct.h"
 #include "pixmapstr.h"
 #include "scrnintstr.h"
+#include "registry.h"
 
 typedef struct _Sertafied {
     struct _Sertafied	*next;
@@ -90,6 +91,7 @@ ClientSleepUntil (ClientPtr client,
 	SertafiedResType = CreateNewResourceType (SertafiedDelete);
 	if (!SertafiedResType)
 	    return FALSE;
+	RegisterResourceName(SertafiedResType, "ClientSleep");
 	SertafiedGeneration = serverGeneration;
 	BlockHandlerRegistered = FALSE;
     }
diff --git a/Xext/sync.c b/Xext/sync.c
index 667f8ab..b1c8cb8 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -64,6 +64,7 @@ PERFORMANCE OF THIS SOFTWARE.
 #include "extnsionst.h"
 #include "dixstruct.h"
 #include "resource.h"
+#include "registry.h"
 #include "opaque.h"
 #include <X11/extensions/syncproto.h>
 #include "syncsrv.h"
@@ -878,6 +879,7 @@ SyncCreateSystemCounter(
 	{
 	    return NULL;
 	}
+	RegisterResourceName(RTCounter, "SyncCounter");
     }
 
     pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
@@ -2113,8 +2115,8 @@ SyncExtensionInit(void)
 	RTCounter = CreateNewResourceType(FreeCounter);
     }
     RTAlarm = CreateNewResourceType(FreeAlarm);
-    RTAwait = CreateNewResourceType(FreeAwait)|RC_NEVERRETAIN;
-    RTAlarmClient = CreateNewResourceType(FreeAlarmClient)|RC_NEVERRETAIN;
+    RTAwait = CreateNewResourceType(FreeAwait);
+    RTAlarmClient = CreateNewResourceType(FreeAlarmClient);
 
     if (RTCounter == 0 || RTAwait == 0 || RTAlarm == 0 ||
 	RTAlarmClient == 0 ||
@@ -2129,6 +2131,12 @@ SyncExtensionInit(void)
 	return;
     }
 
+    RegisterResourceName(RTCounter, "SyncCounter");
+    RegisterResourceName(RTAlarm, "SyncAlarm");
+    RegisterResourceName(RTAwait, "SyncAwait");
+    RegisterResourceName(RTAlarmClient, "SyncAlarmClient");
+    RTAwait |= RC_NEVERRETAIN;
+    RTAlarmClient |= RC_NEVERRETAIN;
     SyncEventBase = extEntry->eventBase;
     SyncErrorBase = extEntry->errorBase;
     EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 5229916..4a38b82 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -36,6 +36,7 @@ SOFTWARE.
 #include "gcstruct.h"
 #include "dixstruct.h"
 #include "resource.h"
+#include "registry.h"
 #include "opaque.h"
 
 #include <X11/extensions/Xv.h>
@@ -1865,7 +1866,9 @@ void XineramifyXv(void)
 
    XvXRTPort = CreateNewResourceType(XineramaDeleteResource);
 
-   if(!xvsp0) return;
+   if (!xvsp0 || !XvXRTPort) return;
+
+   RegisterResourceName(XvXRTPort, "XvXRTPort");
    
    for(i = 0; i < xvsp0->nAdaptors; i++) {
       refAdapt = xvsp0->pAdaptors + i;
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 7c8a3c3..c33c209 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -90,6 +90,7 @@ SOFTWARE.
 #include "extnsionst.h"
 #include "dixstruct.h"
 #include "resource.h"
+#include "registry.h"
 #include "opaque.h"
 #include "input.h"
 
@@ -213,36 +214,42 @@ CreateResourceTypes(void)
       ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
       return FALSE;
     }
-  
+  RegisterResourceName(XvRTPort, "XvRTPort");
+
   if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab)))
     {
       ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
       return FALSE;
     }
-  
+  RegisterResourceName(XvRTGrab, "XvRTGrab");
+
   if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding)))
     {
       ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
       return FALSE;
     }
-  
+  RegisterResourceName(XvRTEncoding, "XvRTEncoding");
+
   if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify)))
     {
       ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
       return FALSE;
     }
-  
+  RegisterResourceName(XvRTVideoNotify, "XvRTVideoNotify");
+
   if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList)))
     {
       ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
       return FALSE;
     }
+  RegisterResourceName(XvRTVideoNotifyList, "XvRTVideoNotifyList");
 
   if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify)))
     {
       ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
       return FALSE;
     }
+  RegisterResourceName(XvRTPortNotify, "XvRTPortNotify");
 
   return TRUE;
 
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index c17a4b1..0a233b1 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -11,6 +11,7 @@
 #include "os.h"
 #include "dixstruct.h"
 #include "resource.h"
+#include "registry.h"
 #include "scrnintstr.h"
 #include "extnsionst.h"
 #include "servermd.h"
@@ -676,12 +677,15 @@ XvMCExtensionInit(void)
 
    if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes)))
 	return;
+   RegisterResourceName(XvMCRTContext, "XvMCRTContext");
 
    if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes)))
 	return;
+   RegisterResourceName(XvMCRTSurface, "XvMCRTSurface");
 
    if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes)))
 	return;
+   RegisterResourceName(XvMCRTSubpicture, "XvMCRTSubpicture");
 
    extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors, 
                               ProcXvMCDispatch, SProcXvMCDispatch,
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 0c12919..372f77f 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -1270,6 +1270,8 @@ XInputExtensionInit(void)
 	XIVersion = thisversion;
 	MakeDeviceTypeAtoms();
 	RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
+	if (!RT_INPUTCLIENT)
+	    FatalError("Failed to add resource type for XI.\n");
 	RegisterResourceName(RT_INPUTCLIENT, "INPUTCLIENT");
 	FixExtensionEvents(extEntry);
 	ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
diff --git a/composite/compext.c b/composite/compext.c
index 976d002..c63bd02 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -53,6 +53,7 @@
 
 #include "compint.h"
 #include "xace.h"
+#include "registry.h"
 #include "protocol-versions.h"
 
 static CARD8	CompositeReqCode;
@@ -555,14 +556,19 @@ CompositeExtensionInit (void)
     CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
     if (!CompositeClientWindowType)
 	return;
+    RegisterResourceName(CompositeClientWindowType, "CompositeClientWindow");
 
     CompositeClientSubwindowsType = CreateNewResourceType (FreeCompositeClientSubwindows);
     if (!CompositeClientSubwindowsType)
 	return;
+    RegisterResourceName(CompositeClientSubwindowsType,
+			 "CompositeClientSubwindows");
 
     CompositeClientOverlayType = CreateNewResourceType (FreeCompositeClientOverlay);
     if (!CompositeClientOverlayType)
 	return;
+    RegisterResourceName(CompositeClientOverlayType,
+			 "CompositeClientOverlay");
 
     if (!dixRequestPrivate(CompositeClientPrivateKey,
 			   sizeof(CompositeClientRec)))
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 449c2fd..044e8ef 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -24,6 +24,7 @@
 #include <dix-config.h>
 #endif
 
+#include "registry.h"
 #include "damageextint.h"
 #include "protocol-versions.h"
 
@@ -500,10 +501,12 @@ DamageExtensionInit(void)
     DamageExtType = CreateNewResourceType (FreeDamageExt);
     if (!DamageExtType)
 	return;
+    RegisterResourceName(DamageExtType, "DamageExt");
 
     DamageExtWinType = CreateNewResourceType (FreeDamageExtWin);
     if (!DamageExtWinType)
 	return;
+    RegisterResourceName(DamageExtWinType, "DamageExtWin");
 
     if (!dixRequestPrivate(DamageClientPrivateKey, sizeof (DamageClientRec)))
 	return;
diff --git a/dbe/dbe.c b/dbe/dbe.c
index a4f853d..78ce912 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -54,6 +54,7 @@
 #include "dbestruct.h"
 #include "midbe.h"
 #include "xace.h"
+#include "registry.h"
 
 /* GLOBALS */
 
@@ -1573,9 +1574,16 @@ DbeExtensionInit(void)
 
     /* Create the resource types. */
     dbeDrawableResType =
-        CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE;
+        CreateNewResourceType(DbeDrawableDelete);
     dbeWindowPrivResType =
         CreateNewResourceType(DbeWindowPrivDelete);
+    if (!dbeDrawableResType || !dbeWindowPrivResType)
+	return;
+    RegisterResourceName(dbeDrawableResType, "dbeDrawable");
+    RegisterResourceName(dbeWindowPrivResType, "dbeWindow");
+
+    dbeDrawableResType |= RC_DRAWABLE;
+
     if (!dixRegisterPrivateOffset(dbeDrawableResType,
 				  offsetof(PixmapRec, devPrivates)))
 	return;
diff --git a/glx/glxext.c b/glx/glxext.c
index 9f9c0ed..546d968 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -347,6 +347,9 @@ void GlxExtensionInit(void)
     __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
     __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
 
+    if (!__glXContextRes || !__glXDrawableRes || !__glXSwapBarrierRes)
+	return;
+
     RegisterResourceName(__glXContextRes, "GLXContext");
     RegisterResourceName(__glXDrawableRes, "GLXDrawable");
     RegisterResourceName(__glXSwapBarrierRes, "GLXSwapBarrier");
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index b30d144..c00ae6e 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -44,6 +44,7 @@
 #include "glxvisuals.h"
 #include "micmap.h"
 #include "glxswap.h"
+#include "registry.h"
 
 /*
 ** Stubs to satisfy miinitext.c references.
@@ -299,6 +300,16 @@ void GlxExtensionInit(void)
     __glXWindowRes = CreateNewResourceType((DeleteType)WindowGone);
     __glXPbufferRes = CreateNewResourceType((DeleteType)PbufferGone);
 
+    if (!__glXContextRes || !__glXClientRes || !__glXPixmapRes ||
+	!__glXWindowRes || !__glXPbufferRes)
+	return;
+
+    RegisterResourceName(__glXContextRes, "GLXContext");
+    RegisterResourceName(__glXClientRes, "GLXClient");
+    RegisterResourceName(__glXPixmapRes, "GLXPixmap");
+    RegisterResourceName(__glXWindowRes, "GLXWindow");
+    RegisterResourceName(__glXPbufferRes, "GLXPbuffer");
+
     /*
     ** Add extension to server extensions.
     */
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 231b098..a2839ea 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -43,6 +43,7 @@
 #include "privates.h"
 #include "dixstruct.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "colormapst.h"
 #include "cursorstr.h"
 #include "scrnintstr.h"
@@ -141,6 +142,11 @@ ephyrDRIExtensionInit (ScreenPtr a_screen)
 
 #ifdef XF86DRI_EVENTS
     EventType = CreateNewResourceType (XF86DRIFreeEvents);
+    if (!EventType) {
+        EPHYR_LOG_ERROR ("failed to register DRI event resource type\n") ;
+        goto out ;
+    }
+    RegisterResourceName(EventType, "DRIEvents");
 #endif
 
     if ((extEntry = AddExtension(XF86DRINAME,
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 4920115..c35a83f 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -39,6 +39,7 @@ from Kaleb S. KEITHLEY
 #include "misc.h"
 #include "dixstruct.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "scrnintstr.h"
 #include "servermd.h"
 #include <X11/extensions/xf86vmproto.h>
@@ -201,6 +202,7 @@ XFree86VidModeExtensionInit(void)
 #endif
 	VidModeErrorBase = extEntry->errorBase;
 #ifdef XF86VIDMODE_EVENTS
+	RegisterResourceName(EventType, "VidModeEvent");
 	XF86VidModeEventBase = extEntry->eventBase;
 	EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
 #endif
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 0de9be6..be0604e 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -51,6 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "misc.h"
 #include "dixstruct.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "colormapst.h"
 #include "cursorstr.h"
 #include "scrnintstr.h"
@@ -792,6 +793,11 @@ DRIExtensionInit(void)
     DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
     DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete);
 
+    if (!DRIDrawablePrivResType || !DRIContextPrivResType)
+	return FALSE;
+    RegisterResourceName(DRIDrawablePrivResType, "DRIDrawable");
+    RegisterResourceName(DRIContextPrivResType, "DRIContext");
+
     RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
 
     return TRUE;
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 035057b..2da9767 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -47,6 +47,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "misc.h"
 #include "dixstruct.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "colormapst.h"
 #include "cursorstr.h"
 #include "scrnintstr.h"
@@ -111,6 +112,9 @@ XFree86DRIExtensionInit(void)
 				 StandardMinorOpcode))) {
 	DRIReqCode = (unsigned char)extEntry->base;
 	DRIErrorBase = extEntry->errorBase;
+#ifdef XF86DRI_EVENTS
+	RegisterResourceName(EventType, "DRIEvent");
+#endif
     }
 }
 
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index dc07b47..112e76c 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -42,6 +42,7 @@
 #include "scrnintstr.h"
 #include "pixmapstr.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "xf86drm.h"
 #include "xfixes.h"
 #include "dri2.h"
@@ -416,6 +417,13 @@ static int DRI2DrawableGone(pointer p, XID id)
 static void
 DRI2ExtensionInit(void)
 {
+    dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
+
+    if (!dri2DrawableRes)
+	return;
+
+    RegisterResourceName(dri2DrawableRes, "DRI2Drawable");
+
     dri2Extension = AddExtension(DRI2_NAME,
 				 DRI2NumberEvents,
 				 DRI2NumberErrors,
@@ -424,7 +432,6 @@ DRI2ExtensionInit(void)
 				 NULL,
 				 StandardMinorOpcode);
 
-    dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
 }
 
 extern Bool noDRI2Extension;
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index d1a6175..26cf5d2 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -37,6 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dixstruct.h"
 #include "globals.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "colormapst.h"
 #include "cursorstr.h"
 #include "scrnintstr.h"
@@ -129,6 +130,8 @@ AppleWMExtensionInit(
         WMEventBase = extEntry->eventBase;
         EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
         appleWMProcs = procsPtr;
+	RegisterResourceName(ClientType, "WMClient");
+	RegisterResourceName(EventType, "WMEvent");
     }
 }
 
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index f570bee..b59f5d3 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "misc.h"
 #include "dixstruct.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "colormapst.h"
 #include "cursorstr.h"
 #include "scrnintstr.h"
@@ -279,7 +280,10 @@ DRIExtensionInit(void)
 {
     DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
 
-    return TRUE;
+    if (DRIDrawablePrivResType != 0)
+	RegisterResourceName(DRIDrawablePrivResType, "DRIDrawable");
+
+    return (DRIDrawablePrivResType != 0);
 }
 
 void
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 3d4d8c2..2383c59 100755
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -34,6 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "misc.h"
 #include "dixstruct.h"
 #include "extnsionst.h"
+#include "registry.h"
 #include "colormapst.h"
 #include "cursorstr.h"
 #include "scrnintstr.h"
@@ -102,6 +103,8 @@ winWindowsWMExtensionInit ()
       WMErrorBase = extEntry->errorBase;
       WMEventBase = extEntry->eventBase;
       EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
+      RegisterResourceName(ClientType, "WMClient");
+      RegisterResourceName(eventResourceType, "WMEvent");
     }
 }
 
diff --git a/mi/miarc.c b/mi/miarc.c
index a3e2580..b4b684b 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -62,6 +62,7 @@ SOFTWARE.
 #include "mifpoly.h"
 #include "mi.h"
 #include "mifillarc.h"
+#include "registry.h"
 #include <X11/Xfuncproto.h>
 
 static double miDsin(double a);
@@ -867,6 +868,7 @@ miComputeWideEllipse(
 	if (!cacheType)
 	{
 	    cacheType = CreateNewResourceType(miFreeArcCache);
+	    RegisterResourceName(cacheType, "miArcCache");
 	    (void) AddResource(FakeClientID(0), cacheType, NULL);
 	}
     } else {
diff --git a/randr/randr.c b/randr/randr.c
index 5944564..7d59a68 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -29,6 +29,8 @@
 #include <dix-config.h>
 #endif
 
+#include "registry.h"
+
 #include "randrstr.h"
 
 /* From render.h */
@@ -339,9 +341,11 @@ RRExtensionInit (void)
     RRClientType = CreateNewResourceType(RRFreeClient);
     if (!RRClientType)
 	return;
+    RegisterResourceName(RRClientType, "RandRClient");
     RREventType = CreateNewResourceType(RRFreeEvents);
     if (!RREventType)
 	return;
+    RegisterResourceName(RREventType, "RandREvent");
     extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
 			     ProcRRDispatch, SProcRRDispatch,
 			     NULL, StandardMinorOpcode);
diff --git a/record/record.c b/record/record.c
index b94b4ae..649f4b2 100644
--- a/record/record.c
+++ b/record/record.c
@@ -42,6 +42,7 @@ and Jim Haggerty of Metheus.
 #include "set.h"
 #include "swaprep.h"
 #include "inputstr.h"
+#include "registry.h"
 
 #include <stdio.h>
 #include <assert.h>
@@ -2878,6 +2879,7 @@ RecordExtensionInit(void)
     RTContext = CreateNewResourceType(RecordDeleteContext);
     if (!RTContext)
 	return;
+    RegisterResourceName(RTContext, "RecordContext");
 
     ppAllContexts = NULL;
     numContexts = numEnabledContexts = numEnabledRCAPs = 0;
diff --git a/render/render.c b/render/render.c
index a32d797..53bb555 100644
--- a/render/render.c
+++ b/render/render.c
@@ -46,6 +46,7 @@
 #include "cursorstr.h"
 #include "xace.h"
 #include "protocol-versions.h"
+#include "registry.h"
 
 #if HAVE_STDINT_H
 #include <stdint.h>
@@ -3241,6 +3242,9 @@ PanoramiXRenderInit (void)
     int	    i;
     
     XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource);
+    if (XRT_PICTURE)
+	RegisterResourceName(XRT_PICTURE, "XineramaPicture");
+
     for (i = 0; i < RenderNumberRequests; i++)
 	PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
     /*
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index aac90e3..ac8d75b 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -59,6 +59,7 @@
 #include "inputstr.h"
 #include "windowstr.h"
 #include "xace.h"
+#include "registry.h"
 
 static RESTYPE		CursorClientType;
 static RESTYPE		CursorHideCountType;
@@ -1091,8 +1092,14 @@ XFixesCursorInit (void)
 	SetCursorScreen (pScreen, cs);
     }
     CursorClientType = CreateNewResourceType(CursorFreeClient);
+    if (CursorClientType)
+	RegisterResourceName(CursorClientType, "XFixesCursorClient");
     CursorHideCountType = CreateNewResourceType(CursorFreeHideCount);
+    if (CursorHideCountType)
+	RegisterResourceName(CursorClientType, "XFixesCursorClient");
     CursorWindowType = CreateNewResourceType(CursorFreeWindow);
+    if (CursorWindowType)
+	RegisterResourceName(CursorWindowType, "XFixesCursorWindow");
 
     if (pInvisibleCursor == NULL) {
 	pInvisibleCursor = createInvisibleCursor();
@@ -1101,6 +1108,6 @@ XFixesCursorInit (void)
 	}
     }
 
-    return CursorClientType && CursorWindowType;
+    return CursorClientType && CursorHideCountType && CursorWindowType;
 }
 
diff --git a/xfixes/region.c b/xfixes/region.c
index 966eda0..b597cda 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -33,6 +33,7 @@ extern int RenderErrBase;
 #include <regionstr.h>
 #include <gcstruct.h>
 #include <window.h>
+#include "registry.h"
 
 RESTYPE RegionResType;
 
@@ -64,7 +65,10 @@ Bool
 XFixesRegionInit (void)
 {
     RegionResType = CreateNewResourceType(RegionResFree);
-    return TRUE;
+    if (RegionResType)
+	RegisterResourceName(RegionResType, "XFixesRegion");
+
+    return RegionResType;
 }
 
 int
diff --git a/xfixes/select.c b/xfixes/select.c
index a5811bd..5a00ea8 100644
--- a/xfixes/select.c
+++ b/xfixes/select.c
@@ -26,6 +26,7 @@
 
 #include "xfixesint.h"
 #include "xace.h"
+#include "registry.h"
 
 static RESTYPE		SelectionClientType, SelectionWindowType;
 static Bool		SelectionCallbackRegistered = FALSE;
@@ -285,6 +286,11 @@ Bool
 XFixesSelectionInit (void)
 {
     SelectionClientType = CreateNewResourceType(SelectionFreeClient);
+    if (SelectionClientType)
+	RegisterResourceName(SelectionClientType, "XFixesSelectionClient");
     SelectionWindowType = CreateNewResourceType(SelectionFreeWindow);
+    if (SelectionWindowType)
+	RegisterResourceName(SelectionWindowType, "XFixesSelectionWindow");
+
     return SelectionClientType && SelectionWindowType;
 }
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 35f8d1c..f5ccd16 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -39,6 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "xace.h"
 #include "xkb.h"
 #include "protocol-versions.h"
+#include "registry.h"
 
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XKMformat.h>
@@ -6704,6 +6705,11 @@ XkbExtensionInit(void)
 {
     ExtensionEntry *extEntry;
 
+    RT_XKBCLIENT = CreateNewResourceType(XkbClientGone);
+    if (!RT_XKBCLIENT)
+	return;
+    RegisterResourceName(RT_XKBCLIENT, "XkbClient");
+
     if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors,
 				 ProcXkbDispatch, SProcXkbDispatch,
 				 NULL, StandardMinorOpcode))) {
@@ -6711,7 +6717,6 @@ XkbExtensionInit(void)
 	XkbEventBase = (unsigned char)extEntry->eventBase;
 	XkbErrorBase = (unsigned char)extEntry->errorBase;
 	XkbKeyboardErrorCode = XkbErrorBase+XkbKeyboard;
-	RT_XKBCLIENT = CreateNewResourceType(XkbClientGone);
     }
     return;
 }
-- 
1.5.6.5



More information about the xorg-devel mailing list