swr: [rasterizer jitter] fix potential jit exit crash
authorTim Rowley <timothy.o.rowley@intel.com>
Mon, 25 Jul 2016 23:05:55 +0000 (17:05 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Thu, 4 Aug 2016 19:38:34 +0000 (14:38 -0500)
Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp

index c6cbccf094ae972461844a823277d7dd2cf610ff..6637cdd7619a951483a1cc0225ffd6a8ed796aae 100644 (file)
@@ -352,6 +352,8 @@ void JitManager::DumpToFile(Function *f, const char *fileName)
 
 extern "C"
 {
+    bool g_DllActive = true;
+
     //////////////////////////////////////////////////////////////////////////
     /// @brief Create JIT context.
     /// @param simdWidth - SIMD width to be used in generated program.
@@ -364,6 +366,9 @@ extern "C"
     /// @brief Destroy JIT context.
     void JITCALL JitDestroyContext(HANDLE hJitContext)
     {
-        delete reinterpret_cast<JitManager*>(hJitContext);
+        if (g_DllActive)
+        {
+            delete reinterpret_cast<JitManager*>(hJitContext);
+        }
     }
 }