CEGUI 0.8.3在vs2005下的运行错误

相关函数原型
inline Window* getParent() const
RenderingSurface& getTargetRenderingSurface() const;


错误在这里发生:

RenderingSurface& tgt = d_parent ? getParent()->getTargetRenderingSurface() : getGUIContext();


汇编代码如下


-------------------------------------------------------------------------------------------------------------------------------
101BD9F9  mov         eax,dword ptr [ebp-10h] 
101BD9FC  cmp         dword ptr [eax+5Ch],0 d_parent与0比较,ZF为0
101BDA00  je          CEGUI::Window::syncTargetSurface+0C9h (101BDA19h) ZF为1则跳转,这里不跳
101BDA02  mov         ecx,dword ptr [ebp-10h] 
101BDA05  call        CEGUI::Window::getParent (10005218h) 调用getParent 
101BDA0A  mov         ecx,eax 调用准备,我估计ecx里保存了this指针
101BDA0C  call        CEGUI::Window::getTargetRenderingSurface (100015AAh) 调用getTargetRenderingSurface
101BDA11  mov         dword ptr [ebp-0F0h],eax 保存结果到临时变量[ebp-0F0h]
101BDA17  jmp         CEGUI::Window::syncTargetSurface+111h (101BDA61h) 跳转到101BDA61
101BDA19  mov         ecx,dword ptr [ebp-10h] 
101BDA1C  call        CEGUI::Window::getGUIContext (10002BE9h) 
101BDA21  push        eax  
101BDA22  lea         ecx,[ebp-0E8h] 
101BDA28  call        CEGUI::RenderingSurface::RenderingSurface (10011536h) 
101BDA2D  mov         dword ptr [ebp-0F4h],eax 
101BDA33  mov         ecx,dword ptr [ebp-0F4h] 
101BDA39  mov         dword ptr [ebp-0F8h],ecx 
101BDA3F  mov         dword ptr [ebp-4],0 
101BDA46  mov         edx,dword ptr [ebp-0ECh] 
101BDA4C  or          edx,1 
101BDA4F  mov         dword ptr [ebp-0ECh],edx 
101BDA55  mov         eax,dword ptr [ebp-0F8h] 
101BDA5B  mov         dword ptr [ebp-0F0h],eax 
101BDA61  mov         ecx,dword ptr [ebp-0F0h] 跳转到这里,将[ebp-0F0h]保存到ecx
101BDA67  mov         dword ptr [ebp-88h],ecx ecx保存到临时变量[ebp-88h]
101BDA6D  mov         edx,dword ptr [ebp-88h] 临时变量[ebp-88h]保存到edx
101BDA73  push        edx   edx压栈,准备函数调用
101BDA74  lea         ecx,[ebp-80h] 传给ecx,准备函数调用
101BDA77  call        CEGUI::RenderingSurface::RenderingSurface (10011536h) 调用拷贝构造函数!!!!
101BDA7C  mov         dword ptr [ebp-4],1 
101BDA83  lea         eax,[ebp-80h] 
101BDA86  mov         dword ptr [tgt],eax 
101BDA89  mov         byte ptr [ebp-4],2 
101BDA8D  mov         ecx,dword ptr [ebp-0ECh] 
101BDA93  and         ecx,1 
101BDA96  je          CEGUI::Window::syncTargetSurface+15Ah (101BDAAAh) 这里跳出拷贝构造函数
101BDA98  and         dword ptr [ebp-0ECh],0FFFFFFFEh 
101BDA9F  lea         ecx,[ebp-0E8h] 

101BDAA5  call        CEGUI::RenderingSurface::~RenderingSurface (10004633h) 

--------------------------------------------------------------------------------------------------------------------------------

总结

vs2005对C++特性支持可能不够。引用返回居然引起了析构。所以CEGUI 0.8.3不要在VS2005下用。

你可能感兴趣的:(CEGUI,0.8.3)