[Bugfix] Find correct colormap in XserverDesktop::serverReset method


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3020 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index 4ab9adc..8dd4aa0 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -23,6 +23,7 @@
 #include <dix-config.h>
 #endif
 
+#include <assert.h>
 #include <stdio.h>
 #include <strings.h>
 #include <unistd.h>
@@ -247,9 +248,16 @@
 void XserverDesktop::serverReset(ScreenPtr pScreen_)
 {
   pScreen = pScreen_;
-  XID* ids = new XID[pScreen->maxInstalledCmaps];
-  cmap = (ColormapPtr)LookupIDByType(ids[0], RT_COLORMAP);
-  delete [] ids;
+  int i;
+  pointer retval;
+
+  i = dixLookupResource(&retval, pScreen->defColormap, RT_COLORMAP, NullClient,
+			DixReadAccess);
+
+  /* Handle suspicious conditions */
+  assert(i != Success);
+
+  cmap = (ColormapPtr) retval;
 }
 
 char* XserverDesktop::substitute(const char* varName)