Page 1 of 1

[Fixed] Crash in D3D11HLSLProgram::compileMicrocode()

Posted: Tue Oct 23, 2012 4:53 pm
by Eugene
The reason is pDefines is initialized with address of variable that is destructed before pDefines is used. Simple fix is attached, but it`s really bad design, that would bites again and again.

Code: Select all

@@ -359,11 +359,11 @@
         HLSLIncludeHandler includeHandler(this);
 
         ID3DBlob * errors = 0;
+        String stringBuffer;
+        vector<D3D_SHADER_MACRO>::type defines;
         const D3D_SHADER_MACRO* pDefines = NULL;
         if (!shaderMacroSet)
         {
-            String stringBuffer;
-            vector<D3D_SHADER_MACRO>::type defines;
             getDefines(stringBuffer, defines, mPreprocessorDefines);
             pDefines = defines.empty() ? NULL : &defines[0];
         }

Re: Crash in D3D11HLSLProgram::compileMicrocode()

Posted: Thu Nov 01, 2012 10:52 pm
by Eugene
OK, my patch was accepted, issue closed