Crash inside CEGUI::System::destroy()
Moderators: CEGUI MVP, CEGUI Team
Crash inside CEGUI::System::destroy()
Hello again,
I use Visual Studio 11 and DirectX 11 API with DXUT. I've added CEGUI::System::destroy() inside OnDeviceDestroy() callback, however it causes my program to crash. To be exact, crash happens on line 85 in CEGUIWindowRendererModule.cpp, std::vector throws "vector iterators incompatible" error. d_registry vector is empty. I'm unsure what other information to provide, let me know what you need.
Log: http://dl.dropbox.com/u/2637453/CEGUI/C ... 0-2011.log
I use Visual Studio 11 and DirectX 11 API with DXUT. I've added CEGUI::System::destroy() inside OnDeviceDestroy() callback, however it causes my program to crash. To be exact, crash happens on line 85 in CEGUIWindowRendererModule.cpp, std::vector throws "vector iterators incompatible" error. d_registry vector is empty. I'm unsure what other information to provide, let me know what you need.
Log: http://dl.dropbox.com/u/2637453/CEGUI/C ... 0-2011.log
Re: Crash inside CEGUI::System::destroy()
On your destroy call, do this:
myRenderer should be the renderer you declared in your header file along with a reset:
Code: Select all
CEGUI::System::getSingleton().destroy();
delete myRenderer;
myRenderer should be the renderer you declared in your header file along with a reset:
Code: Select all
protected:
CEGUI::Renderer* myRenderer;
Re: Crash inside CEGUI::System::destroy()
Problem didn't go away; same line, same problem.
Anymore ideas?
Or it's VS11 fault again?
Edit:
It cannot be VS11 fault if really. I compiled CEGUI library and Samples with VS11 and they work correctly.
Code: Select all
CEGUI::Renderer *renderer = CEGUI::System::getSingleton().getRenderer();
CEGUI::System::getSingleton().destroy();
delete renderer;
Anymore ideas?
Or it's VS11 fault again?
Edit:
It cannot be VS11 fault if really. I compiled CEGUI library and Samples with VS11 and they work correctly.
Re: Crash inside CEGUI::System::destroy()
http://www.cegui.org.uk/docs/current/cl ... e03dd57111
You should destroy with renderer if you are bootstrapping with renderer.
You should destroy with renderer if you are bootstrapping with renderer.
Re: Crash inside CEGUI::System::destroy()
Still same problem.
Providing my code just in case my initialization is wrong:
Log: http://dl.dropbox.com/u/2637453/CEGUI/C ... 0-2011.log
Edit:
This happens only if I create scheme, without scheme there's no errors. I'm thinking about trying to build in VS10 ...
Edit2:
Just tried VS10; recompiled CEGUI using VS10, compiled my code using VS10, ran it, closed program - same error.
Code: Select all
CEGUI::Direct3D11Renderer *renderer = (CEGUI::Direct3D11Renderer*)CEGUI::System::getSingleton().getRenderer();
renderer->destroySystem();
Providing my code just in case my initialization is wrong:
Code: Select all
HRESULT CALLBACK OnSwapChainResized(ID3D11Device *pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC *pBackBufferSurfaceDesc, void *pUserContext) {
float fAspectRatio = pBackBufferSurfaceDesc->Width / (float)pBackBufferSurfaceDesc->Height;
camera.SetProjParams(D3DX_PI * 0.25f, fAspectRatio, 0.1, 10000);
static CEGUI::Direct3D11Renderer *renderer = 0;
if(!renderer) {
renderer = &CEGUI::Direct3D11Renderer::bootstrapSystem(pDevice, pDeviceContext);
CEGUI::DefaultResourceProvider* rp = (CEGUI::DefaultResourceProvider*)(CEGUI::System::getSingleton().getResourceProvider());
rp->setResourceGroupDirectory("schemes", "datafiles/schemes/");
rp->setResourceGroupDirectory("imagesets", "datafiles/imagesets/");
rp->setResourceGroupDirectory("fonts", "datafiles/fonts/");
rp->setResourceGroupDirectory("looknfeels", "datafiles/looknfeel/");
rp->setResourceGroupDirectory("layouts", "datafiles/layouts/");
CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::Imageset::setDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
if(parser->isPropertyPresent("SchemaDefaultResourceGroup"))
parser->setProperty("SchemaDefaultResourceGroup", "schemas");
CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
using namespace CEGUI;
SchemeManager::getSingleton().create("TaharezLook.scheme");
System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
WindowManager& winMgr = WindowManager::getSingleton();
DefaultWindow* root = (DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");
System::getSingleton().setGUISheet(root);
FrameWindow* wnd = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window");
root->addChildWindow(wnd);
wnd->setPosition(UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
wnd->setSize(UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
wnd->setMaxSize(UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
wnd->setMinSize(UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
wnd->setText("Hello World!");
}
return S_OK;
}
void CALLBACK OnFrameMove(double fTime, float fElapsedTime, void *pUserContext) {
camera.FrameMove(fElapsedTime);
model.OnFrameMove(fElapsedTime);
CEGUI::System::getSingleton().injectTimePulse(fElapsedTime);
}
void CALLBACK OnFrameRender(ID3D11Device *pd3dDevice, ID3D11DeviceContext *pd3dImmediateContext, double fTime, float fElapsedTime, void *pUserContext) {
float ClearColor[4] = {0.2, 0.2, 0.7, 0};
ID3D11RenderTargetView *pRTV = DXUTGetD3D11RenderTargetView();
pDeviceContext->ClearRenderTargetView(pRTV, ClearColor);
// Clear the depth stencil
ID3D11DepthStencilView *pDSV = DXUTGetD3D11DepthStencilView();
pDeviceContext->ClearDepthStencilView(pDSV, D3D11_CLEAR_DEPTH, 1, 0);
pDeviceContext->OMSetRenderTargets(1, &pRTV, pDSV);
CEGUI::System::getSingleton().renderGUI();
}
void CALLBACK OnDeviceDestroy(void *pUserContext) {
CEGUI::Direct3D11Renderer *renderer = (CEGUI::Direct3D11Renderer*)CEGUI::System::getSingleton().getRenderer();
renderer->destroySystem();
}
LRESULT CALLBACK MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool *pbNoFurtherProcessing, void *pUserContext) {
camera.HandleMessages(hWnd, uMsg, wParam, lParam);
if(uMsg == WM_MOUSEMOVE)
CEGUI::System::getSingleton().injectMousePosition((float)LOWORD(lParam), (float)HIWORD(lParam));
return 0;
}
Log: http://dl.dropbox.com/u/2637453/CEGUI/C ... 0-2011.log
Edit:
This happens only if I create scheme, without scheme there's no errors. I'm thinking about trying to build in VS10 ...
Edit2:
Just tried VS10; recompiled CEGUI using VS10, compiled my code using VS10, ran it, closed program - same error.
Re: Crash inside CEGUI::System::destroy()
Sorry for double post.
CEGUI initialization is taken from samples, window code is taken from First Window sample too, therefore I cannot imagine where could be the problem (unless I'm complete retard and missed something tens of times)
I attached demo code (link in the bottom), and steps which I followed to reproduce this error, maybe I simply don't provide enough information, I don't know. Hopefully someone will be able to help me now
Anyways... Here's what I did and managed to reproduce the error:
1. Downloaded attached demo;
2. Downloaded CEGUI 0.7.5 ( http://prdownloads.sourceforge.net/cray ... p?download );
3. Downloaded dependencies for VS10 ( http://prdownloads.sourceforge.net/cray ... p?download );
4. Extracted CEGUI into demo's solution folder;
5. Extracted dependencies into CEGUI folder;
6. Edited CEGUI settings ( .\CEGUI-0.7.5\projects\premake\config.lua ), I made following edits:
----1) OPENGL_RENDERER = false,
----2) DIRECT3D9_RENDERER = false,
----3) DIRECT3D11_RENDERER = true,
----4) LUA_SCRIPT_MODULE = false;
7. Ran build_vs2008.bat;
8. Opened CEGUI.sln using VS10 and converted solution;
9. Choose Debug_Static build, and build solution;
10. It finally compiled. Now I open demo solution and compile Debug build (if previous steps were followed all includes and libraries will be included/linked successfully (Debug build only));
11. Copied datafiles folder from CEGUI into Demo project folder;
12. Pressed "Debug > Start Without Debugging" in Visual Studio, when program started pressed ESC to quit it and got same error (vector iterators incompatible).
Link: http://dl.dropbox.com/u/2637453/CEGUI/Demo.zip
CEGUI initialization is taken from samples, window code is taken from First Window sample too, therefore I cannot imagine where could be the problem (unless I'm complete retard and missed something tens of times)
I attached demo code (link in the bottom), and steps which I followed to reproduce this error, maybe I simply don't provide enough information, I don't know. Hopefully someone will be able to help me now
Anyways... Here's what I did and managed to reproduce the error:
1. Downloaded attached demo;
2. Downloaded CEGUI 0.7.5 ( http://prdownloads.sourceforge.net/cray ... p?download );
3. Downloaded dependencies for VS10 ( http://prdownloads.sourceforge.net/cray ... p?download );
4. Extracted CEGUI into demo's solution folder;
5. Extracted dependencies into CEGUI folder;
6. Edited CEGUI settings ( .\CEGUI-0.7.5\projects\premake\config.lua ), I made following edits:
----1) OPENGL_RENDERER = false,
----2) DIRECT3D9_RENDERER = false,
----3) DIRECT3D11_RENDERER = true,
----4) LUA_SCRIPT_MODULE = false;
7. Ran build_vs2008.bat;
8. Opened CEGUI.sln using VS10 and converted solution;
9. Choose Debug_Static build, and build solution;
10. It finally compiled. Now I open demo solution and compile Debug build (if previous steps were followed all includes and libraries will be included/linked successfully (Debug build only));
11. Copied datafiles folder from CEGUI into Demo project folder;
12. Pressed "Debug > Start Without Debugging" in Visual Studio, when program started pressed ESC to quit it and got same error (vector iterators incompatible).
Link: http://dl.dropbox.com/u/2637453/CEGUI/Demo.zip
Last edited by Ripiz on Thu Oct 13, 2011 12:55, edited 1 time in total.
Re: Crash inside CEGUI::System::destroy()
The problem sounds as if the interface of std::vector changed between msvc10 and msvc11.
I'm sure you triple-checked to link against the wrong lib, so I'd think it has something to with the dependencies.
You really should recompile all the dependencies manually.
I'm sure you triple-checked to link against the wrong lib, so I'd think it has something to with the dependencies.
You really should recompile all the dependencies manually.
Re: Crash inside CEGUI::System::destroy()
As I said, I used VS10 to build these. CEGUI Samples don't have any problems either, even if I use VS11. VS10 debugger points into VS10 vector file, not VS11, so I assume it links against correct one too.
Re: Crash inside CEGUI::System::destroy()
Sorry for double post again.
Just tried to compile on laptop, which never had VS11, and I get same error. It's definitely something wrong with my code but I have no idea what's exactly.
Just tried to compile on laptop, which never had VS11, and I get same error. It's definitely something wrong with my code but I have no idea what's exactly.
Re: Crash inside CEGUI::System::destroy()
You should be resetting your CEGUI before destroying it!
i.e.
i.e.
Code: Select all
void CALLBACK OnDeviceDestroy(void *pUserContext) {
ResetGUI();
CEGUI::Direct3D11Renderer *renderer = (CEGUI::Direct3D11Renderer*)CEGUI::System::getSingleton().getRenderer();
renderer->destroySystem();
}
// Define YourLayoutContainer with layout (YourLayoutContainer yourlayout;)
void Whatever::ResetGUI() {
Whatever::YourLayoutContainer::iterator itr;
for(itr = yourlayout.begin(); itr != yourlayout.end(); itr++) {
itr->second->destroy();
}
}
}
Re: Crash inside CEGUI::System::destroy()
Tytanis wrote:You should be resetting your CEGUI before destroying it!
What? You don't have to iterate over windows and destroy each one of them, it is good practice but it's not necessary. The window manager will take care of that for you upon destruction anyways.
Re: Crash inside CEGUI::System::destroy()
Kulik wrote:Tytanis wrote:You should be resetting your CEGUI before destroying it!
What? You don't have to iterate over windows and destroy each one of them, it is good practice but it's not necessary. The window manager will take care of that for you upon destruction anyways.
Well problem isn't about window. It's about destruction of scheme; if I don't create window it still throws error, however if I don't load scheme it's all fine.
Maybe I need to initialize CEGUI inside object or something? I think that's the only significant difference between my implementation and samples.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Crash inside CEGUI::System::destroy()
I just want to add that mentioning the line and source file within CEGUI where an issue occurs is about as useful as a chocolate teapot. Context is everything. Any issue where you get exceptions, assertions, 'crashes' or anything else unexpected, the only way of seeing at least some of the relevant context is by providing - at least - a debug callstack (i.e one which include symbols) from the point where the issue occurs.
This said, it does not mean that after seeing this people will instantly know what the issue is, but it provides 1000x more diagnostic information than everything else posted in this thread so far.
CE.
This said, it does not mean that after seeing this people will instantly know what the issue is, but it provides 1000x more diagnostic information than everything else posted in this thread so far.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Crash inside CEGUI::System::destroy()
CrazyEddie, I understand that.
Few posts ago ( viewtopic.php?f=10&t=5868#p27814 ) I have posted steps I've done to compile CEGUI, also I've posted link to code, which has same issue.
No one told me if they are able to reproduce the problem (or not able to), therefore I assumed it's reproducible. (also I personally was able to reproduce it on two different computers, so it's supposed to work for everyone)
If it'll appear not reproducible then I'll post callstack, however if you'll be able to create same issue, then there's no need to even show callstack, as mine will simply have different pointer values.
Thank you for reply.
P.S. I used VS10 for the demo.
Few posts ago ( viewtopic.php?f=10&t=5868#p27814 ) I have posted steps I've done to compile CEGUI, also I've posted link to code, which has same issue.
No one told me if they are able to reproduce the problem (or not able to), therefore I assumed it's reproducible. (also I personally was able to reproduce it on two different computers, so it's supposed to work for everyone)
If it'll appear not reproducible then I'll post callstack, however if you'll be able to create same issue, then there's no need to even show callstack, as mine will simply have different pointer values.
Thank you for reply.
P.S. I used VS10 for the demo.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Crash inside CEGUI::System::destroy()
Ripiz wrote:...I've posted link to code, which has same issue.
No one told me if they are able to reproduce the problem (or not able to), therefore I assumed it's reproducible.
The reason that nobody has responded to this (one way or the other) is that nobody is likely to take your code and try to compile it and test for this issue - and the reason for this is that nobody really cares about your issues
Sure, if someone can come up with an answer based on their experiences and the information posted, they will. But to actually take time out to compile and test some random code on a forum? Extremely long odds. (For info, I most definitely will not do that, except in cases where it's 99% likely a CEGUI issue, and I've been unable to reproduce it any other way. Of course, I also do tricks in return for money ).
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: No registered users and 8 guests