dri2: Clean up the common dri2 options at screen destroy.
authorEric Anholt <eric@anholt.net>
Wed, 18 Aug 2010 23:17:10 +0000 (16:17 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 18 Aug 2010 23:18:38 +0000 (16:18 -0700)
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h

index dce84ef0deb37e2c6f48f795542f0cece88fa1f0..5eb8b62f450bf059456be973a397607289975341 100644 (file)
@@ -714,6 +714,9 @@ static void driDestroyScreen(__DRIscreen *psp)
           (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
           (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
           (void)drmCloseOnce(psp->fd);
+       } else {
+          driDestroyOptionCache(&psp->optionCache);
+          driDestroyOptionInfo(&psp->optionInfo);
        }
 
        free(psp);
@@ -839,7 +842,6 @@ dri2CreateNewScreen(int scrn, int fd,
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
     drmVersionPtr version;
-    driOptionCache options;
 
     if (driDriverAPI.InitScreen2 == NULL)
         return NULL;
@@ -873,8 +875,10 @@ dri2CreateNewScreen(int scrn, int fd,
 
     psp->DriverAPI = driDriverAPI;
 
-    driParseOptionInfo(&options, __dri2ConfigOptions, __dri2NConfigOptions);
-    driParseConfigFiles(&psp->optionCache, &options, psp->myNum, "dri2");
+    driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
+                      __dri2NConfigOptions);
+    driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
+                       "dri2");
 
     return psp;
 }
index e2fcdaa63894651037292f4982d16205bfda1359..5096d22cad386045d03b7b3ee908981d46875a7e 100644 (file)
@@ -536,6 +536,7 @@ struct __DRIscreenRec {
     /* The lock actually in use, old sarea or DRI2 */
     drmLock *lock;
 
+    driOptionCache optionInfo;
     driOptionCache optionCache;
    unsigned int api_mask;
 };