[Fixed] Crash in D3D11HLSLProgram::compileMicrocode()

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 183
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine

[Fixed] Crash in D3D11HLSLProgram::compileMicrocode()

Post by Eugene » Tue Oct 23, 2012 4:53 pm

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];
         }
Last edited by Eugene on Thu Nov 01, 2012 10:54 pm, edited 2 times in total.
0 x

User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 183
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine

Re: Crash in D3D11HLSLProgram::compileMicrocode()

Post by Eugene » Thu Nov 01, 2012 10:52 pm

OK, my patch was accepted, issue closed
0 x

Post Reply