Page 1 of 1

[Solved]Event Crash Issues

Posted: Fri Mar 06, 2009 02:07
by Icewave
Hi all.

Im having a bit of an issue with the event subscriber (ive found so many other posts about this and none of them fixed it)

Code: Select all

void GUIManager::CreateGUI()
{

   IDirect3DDevice9* Device = dbGetDirect3DDevice();
   CEGUI::DirectX9Renderer* MyRender = new CEGUI::DirectX9Renderer(Device, 0);
   new CEGUI::System( MyRender );

   CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());
   rp->setResourceGroupDirectory("schemes", "./data/GUI/schemes/");
   rp->setResourceGroupDirectory("imagesets",    "./data/GUI/imagesets/");
   rp->setResourceGroupDirectory("fonts",       "./data/GUI/fonts/");
   rp->setResourceGroupDirectory("layouts",    "./data/GUI/layouts/");
   rp->setResourceGroupDirectory("looknfeels", "./data/GUI/looknfeel/");
   rp->setResourceGroupDirectory("lua_scripts", "./data/GUI/lua_scripts/");
   CEGUI::Imageset::setDefaultResourceGroup("imagesets");
   CEGUI::Scheme::setDefaultResourceGroup("schemes");
   CEGUI::Font::setDefaultResourceGroup("fonts");
   CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
   CEGUI::WindowManager::setDefaultResourceGroup("layouts");
   CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
   CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLook.scheme", "schemes");


   CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
   CEGUI::Window* MyRoot  = wmgr.createWindow("DefaultWindow", "root");
   CEGUI::System::getSingleton().setGUISheet(MyRoot);

   CEGUI::FrameWindow* fWnd;
   fWnd = static_cast<CEGUI::FrameWindow*>(wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" ));
   MyRoot->addChildWindow( fWnd );
   //CEGUI::FrameWindow* fWnd = (CEGUI::FrameWindow*)wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" );
   CEGUI::PushButton *btn;
   btn = static_cast<CEGUI::PushButton*>(wmgr.createWindow("TaharezLook/Button", "QuitButton"));
   fWnd->setText( "Hello World!" );
   fWnd->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.25f, 0 ), CEGUI::UDim( 0.25f, 0 ) ) );
   fWnd->setSize( CEGUI::UVector2( CEGUI::UDim( 0.5f, 0 ), CEGUI::UDim( 0.5f, 0 ) ) );
   
   CEGUI::PushButton *btn;
   btn = static_cast<CEGUI::PushButton*>(wmgr.createWindow("TaharezLook/Button", "QuitButton"));
   fWnd->addChildWindow(btn);
   btn->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.93f)));
   btn->setSize(CEGUI::UVector2(cegui_reldim(0.50f), cegui_reldim( 0.05f)));
   btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUIManager::DisableCamera, this));

   //fWnd->subscribeEvent(CEGUI::FrameWindow::EventMouseEnters, CEGUI::Event::Subscriber(&GUIManager::DisableCamera, this));
   //wmgr.getWindow("testWindow")->subscribeEvent(CEGUI::FrameWindow::EventMouseButtonDown, CEGUI::Event::Subscriber(&GUIManager::DisableCamera, this));
   //pMoveUpButton->subscribeEvent(CEGUI::PushButton::EventMouseButtonDown, CEGUI::Event::Subscriber(&GUIHandler::MoveUp_OnClick, this));
}



Debug: In debug mode, the exe dosent even start, it crashes on this line

Code: Select all

   btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUIManager::DisableCamera, this));


Output:

Code: Select all

First-chance exception at 0x00a8a277 in Nomad Client.exe: 0xC0000005: Access violation reading location 0x00000008.
Unhandled exception at 0x00a8a277 in Nomad Client.exe: 0xC0000005: Access violation reading location 0x00000008.


Call Stack:

Code: Select all

>   Nomad Client.exe!GUIManager::CreateGUI()  Line 104 + 0x4a bytes   C++
    Nomad Client.exe!Main::Main()  Line 18   C++
    Nomad Client.exe!DarkGDK()  Line 301 + 0x25 bytes   C++
    Nomad Client.exe!_WinMain@16()  + 0x13 bytes   C++
    Nomad Client.exe!__tmainCRTStartup()  Line 263 + 0x1b bytes   C
    kernel32.dll!777be3f3()    
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]   
    ntdll.dll!77dacfed()    
    ntdll.dll!77dad1ff()    


Disassembly

Code: Select all

   btn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUIManager::DisableCamera, this));
00A8A22D  mov         eax,dword ptr [ebp-10h]
00A8A230  push        eax 
00A8A231  push        offset GUIManager::DisableCamera (0A7717Fh)
00A8A236  lea         ecx,[ebp-7Ch]
00A8A239  call        CEGUI::SubscriberSlot::SubscriberSlot<GUIManager> (0A76BE9h)
00A8A23E  mov         dword ptr [ebp-1410h],eax
00A8A244  mov         ecx,dword ptr [ebp-1410h]
00A8A24A  mov         dword ptr [ebp-1414h],ecx
00A8A250  mov         dword ptr [ebp-4],30h
00A8A257  mov         edx,dword ptr [ebp-1414h]
00A8A25D  mov         eax,dword ptr [edx]
00A8A25F  push        eax 
00A8A260  mov         ecx,dword ptr [__imp_CEGUI::PushButton::EventClicked (0C60BD4Ch)]
00A8A266  push        ecx 
00A8A267  lea         edx,[ebp-78h]
00A8A26A  push        edx 
00A8A26B  mov         ecx,dword ptr [ebp-2Ch]
00A8A26E  add         ecx,24h
00A8A271  mov         eax,dword ptr [ebp-2Ch]
00A8A274  mov         edx,dword ptr [eax+24h]
>>> 00A8A277  mov         eax,dword ptr [edx+8] <<<
00A8A27A  call        eax   
00A8A27C  lea         ecx,[ebp-78h]
00A8A27F  call        dword ptr [__imp_CEGUI::RefCounted<CEGUI::BoundSlot>::~RefCounted<CEGUI::BoundSlot> (0C60BD50h)]
00A8A285  mov         dword ptr [ebp-4],0FFFFFFFFh
00A8A28C  lea         ecx,[ebp-7Ch]
00A8A28F  call        dword ptr [__imp_CEGUI::SubscriberSlot::~SubscriberSlot (0C60BD58h)]



And in Release Mode the client loads fine... BUT when you try and use the button
Image

The callstack and output windows are useless when that happens...

This is my first app with CEGUI, so im just hoping ive done somthing rong haha... im hoping that its no DarkGDK causing this O-o

Thanks in advance for any help you can give
-- Icewave

edit:
i suppose i should add im running windows 64x (but compiling to win32 and running) and using Microsoft Visual C++ 2008 Express SP1

And heres the CEGUI.log file from release mode:

Code: Select all

06/03/2009 11:18:54 (Std)    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
06/03/2009 11:18:54 (Std)    +                     Crazy Eddie's GUI System - Event log                    +
06/03/2009 11:18:54 (Std)    +                          (http://www.cegui.org.uk/)                         +
06/03/2009 11:18:54 (Std)    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

06/03/2009 11:18:54 (Std)    CEGUI::Logger singleton created. (0ADA9280)
06/03/2009 11:18:54 (Std)    ---- Begining CEGUI System initialisation ----
06/03/2009 11:18:54 (Std)    CEGUI::ImagesetManager singleton created (0C44BF88)
06/03/2009 11:18:54 (Std)    CEGUI::FontManager singleton created. (0C446938)
06/03/2009 11:18:54 (Std)    CEGUI::WindowFactoryManager singleton created
06/03/2009 11:18:54 (Std)    CEGUI::WindowManager singleton created (0C44C730)
06/03/2009 11:18:54 (Std)    CEGUI::SchemeManager singleton created. (0C44AB58)
06/03/2009 11:18:54 (Std)    CEGUI::MouseCursor singleton created. (0C44F980)
06/03/2009 11:18:54 (Std)    CEGUI::GlobalEventSet singleton created. (0ADA0E48)
06/03/2009 11:18:54 (Std)    CEGUI::WidgetLookManager singleton created. (0ADA3E30)
06/03/2009 11:18:54 (Std)    CEGUI::WindowRendererManager singleton created (0C44EA50)
06/03/2009 11:18:54 (Std)    WindowFactory for 'DefaultWindow' windows added. (682CF778)
06/03/2009 11:18:54 (Std)    WindowFactory for 'DragContainer' windows added. (682CF818)
06/03/2009 11:18:54 (Std)    WindowFactory for 'ScrolledContainer' windows added. (682CF8B8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'ClippedContainer' windows added. (682CF958)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Checkbox' windows added. (682CF9F8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/PushButton' windows added. (682D0358)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/RadioButton' windows added. (682D03F8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Combobox' windows added. (682CFB38)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/ComboDropList' windows added. (682CFA98)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Editbox' windows added. (682CFBD8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/FrameWindow' windows added. (682CFC78)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/ItemEntry' windows added. (682CFD18)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Listbox' windows added. (682CFEF8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/ListHeader' windows added. (682CFDB8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/ListHeaderSegment' windows added. (682CFE58)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Menubar' windows added. (682D0038)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/PopupMenu' windows added. (682D0218)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/MenuItem' windows added. (682CFF98)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/MultiColumnList' windows added. (682D00D8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/MultiLineEditbox' windows added. (682D0178)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/ProgressBar' windows added. (682D02B8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/ScrollablePane' windows added. (682D0498)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Scrollbar' windows added. (682D0538)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Slider' windows added. (682D05D8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Spinner' windows added. (682D0678)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/TabButton' windows added. (682D0718)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/TabControl' windows added. (682D07B8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Thumb' windows added. (682D0858)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Titlebar' windows added. (682D08F8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Tooltip' windows added. (682D0998)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/ItemListbox' windows added. (682D0A38)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/GroupBox' windows added. (682D0AD8)
06/03/2009 11:18:54 (Std)    WindowFactory for 'CEGUI/Tree' windows added. (682D0B78)
06/03/2009 11:18:54 (Std)    Window type alias named 'DefaultGUISheet' added for window type 'DefaultWindow'.
06/03/2009 11:18:54 (Std)    CEGUI::System singleton created. (0016D418)
06/03/2009 11:18:54 (Std)    ---- CEGUI System initialisation completed ----
06/03/2009 11:18:54 (Std)    ---- Version 0.6.2 ----
06/03/2009 11:18:54 (Std)    ---- Renderer module is: CEGUI::DirectX81Renderer - Official Direct3D 9 based renderer module for CEGUI ----
06/03/2009 11:18:54 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
06/03/2009 11:18:54 (Std)    ---- Scripting module is: None ----
06/03/2009 11:18:54 (Std)    Attempting to load Scheme from file 'TaharezLook.scheme'.
06/03/2009 11:18:54 (Std)    Attempting to create an Imageset from the information specified in file 'TaharezLook.imageset'.
06/03/2009 11:18:54 (Std)    Started creation of Imageset from XML specification:
06/03/2009 11:18:54 (Std)    ---- CEGUI Imageset name: TaharezLook
06/03/2009 11:18:54 (Std)    ---- Source texture file: TaharezLook.tga in resource group: (Default)
06/03/2009 11:18:54 (Std)    Attempting to create Font from the information specified in file 'Commonwealth-10.font'.
06/03/2009 11:18:54 (Std)    Started creation of FreeType Font:
06/03/2009 11:18:54 (Std)    ---- CEGUI font name: Commonwealth-10
06/03/2009 11:18:54 (Std)    ----     Source file: Commonv2c.ttf in resource group: (Default)
06/03/2009 11:18:54 (Std)    ---- Real point size: 10
06/03/2009 11:18:54 (Std)    Succsessfully loaded 219 glyphs
06/03/2009 11:18:54 (Std)    ===== Falagard 'root' element: look and feel parsing begins =====
06/03/2009 11:18:54 (Std)    ===== Look and feel parsing completed =====
06/03/2009 11:18:54 (Std)    No window renderer factories specified for module 'CEGUIFalagardWRBase' - adding all available factories...
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Button' added. (6FB6E538)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Default' added. (6FB6E718)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Editbox' added. (6FB6D778)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/FrameWindow' added. (6FB6E678)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/ItemEntry' added. (6FB6DC78)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/ListHeader' added. (6FB6D638)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/ListHeaderSegment' added. (6FB6D9F8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Listbox' added. (6FB6E358)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Menubar' added. (6FB6DA98)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/MenuItem' added. (6FB6DF98)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/MultiColumnList' added. (6FB6DE58)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/MultiLineEditbox' added. (6FB6D6D8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/PopupMenu' added. (6FB6E2B8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/ProgressBar' added. (6FB6DB38)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/ScrollablePane' added. (6FB6E3F8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Scrollbar' added. (6FB6E218)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Slider' added. (6FB6E498)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Static' added. (6FB6E178)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/StaticImage' added. (6FB6E5D8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/StaticText' added. (6FB6DEF8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/SystemButton' added. (6FB6DBD8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/TabButton' added. (6FB6DD18)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/TabControl' added. (6FB6D8B8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Titlebar' added. (6FB6E0D8)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/ToggleButton' added. (6FB6D958)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Tooltip' added. (6FB6D818)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/ItemListbox' added. (6FB6E038)
06/03/2009 11:18:54 (Std)    WindowRendererFactory 'Falagard/Tree' added. (6FB6DDB8)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Button' using base type 'CEGUI/PushButton', window renderer 'Falagard/Button' and Look'N'Feel 'TaharezLook/Button'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Checkbox' using base type 'CEGUI/Checkbox', window renderer 'Falagard/ToggleButton' and Look'N'Feel 'TaharezLook/Checkbox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ImageButton' using base type 'CEGUI/PushButton', window renderer 'Falagard/Button' and Look'N'Feel 'TaharezLook/ImageButton'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/RadioButton' using base type 'CEGUI/RadioButton', window renderer 'Falagard/ToggleButton' and Look'N'Feel 'TaharezLook/RadioButton'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/FrameWindow' using base type 'CEGUI/FrameWindow', window renderer 'Falagard/FrameWindow' and Look'N'Feel 'TaharezLook/FrameWindow'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Titlebar' using base type 'CEGUI/Titlebar', window renderer 'Falagard/Titlebar' and Look'N'Feel 'TaharezLook/Titlebar'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/SystemButton' using base type 'CEGUI/PushButton', window renderer 'Falagard/SystemButton' and Look'N'Feel 'TaharezLook/Button'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Editbox' using base type 'CEGUI/Editbox', window renderer 'Falagard/Editbox' and Look'N'Feel 'TaharezLook/Editbox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/MultiLineEditbox' using base type 'CEGUI/MultiLineEditbox', window renderer 'Falagard/MultiLineEditbox' and Look'N'Feel 'TaharezLook/MultiLineEditbox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Menubar' using base type 'CEGUI/Menubar', window renderer 'Falagard/Menubar' and Look'N'Feel 'TaharezLook/Menubar'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/PopupMenu' using base type 'CEGUI/PopupMenu', window renderer 'Falagard/PopupMenu' and Look'N'Feel 'TaharezLook/PopupMenu'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/MenuItem' using base type 'CEGUI/MenuItem', window renderer 'Falagard/MenuItem' and Look'N'Feel 'TaharezLook/MenuItem'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/AlternateProgressBar' using base type 'CEGUI/ProgressBar', window renderer 'Falagard/ProgressBar' and Look'N'Feel 'TaharezLook/AltProgressBar'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ProgressBar' using base type 'CEGUI/ProgressBar', window renderer 'Falagard/ProgressBar' and Look'N'Feel 'TaharezLook/ProgressBar'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/VUMeter' using base type 'CEGUI/ProgressBar', window renderer 'Falagard/ProgressBar' and Look'N'Feel 'TaharezLook/VUMeter'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/VerticalScrollbar' using base type 'CEGUI/Scrollbar', window renderer 'Falagard/Scrollbar' and Look'N'Feel 'TaharezLook/VerticalScrollbar'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/HorizontalScrollbar' using base type 'CEGUI/Scrollbar', window renderer 'Falagard/Scrollbar' and Look'N'Feel 'TaharezLook/HorizontalScrollbar'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/VerticalScrollbarThumb' using base type 'CEGUI/Thumb', window renderer 'Falagard/Button' and Look'N'Feel 'TaharezLook/VerticalScrollbarThumb'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/HorizontalScrollbarThumb' using base type 'CEGUI/Thumb', window renderer 'Falagard/Button' and Look'N'Feel 'TaharezLook/HorizontalScrollbarThumb'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/LargeVerticalScrollbar' using base type 'CEGUI/Scrollbar', window renderer 'Falagard/Scrollbar' and Look'N'Feel 'TaharezLook/LargeVerticalScrollbar'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/LargeVerticalScrollbarThumb' using base type 'CEGUI/Thumb', window renderer 'Falagard/Button' and Look'N'Feel 'TaharezLook/LargeVerticalScrollbarThumb'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/TabButton' using base type 'CEGUI/TabButton', window renderer 'Falagard/TabButton' and Look'N'Feel 'TaharezLook/TabButton'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/TabControl' using base type 'CEGUI/TabControl', window renderer 'Falagard/TabControl' and Look'N'Feel 'TaharezLook/TabControl'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/TabContentPane' using base type 'DefaultWindow', window renderer 'Falagard/Default' and Look'N'Feel 'TaharezLook/TabContentPane'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/TabButtonPane' using base type 'DefaultWindow', window renderer 'Falagard/Default' and Look'N'Feel 'TaharezLook/TabButtonPane'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ComboDropList' using base type 'CEGUI/ComboDropList', window renderer 'Falagard/Listbox' and Look'N'Feel 'TaharezLook/ComboDropList'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ComboEditbox' using base type 'CEGUI/Editbox', window renderer 'Falagard/Editbox' and Look'N'Feel 'TaharezLook/ComboEditbox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Combobox' using base type 'CEGUI/Combobox', window renderer 'Falagard/Default' and Look'N'Feel 'TaharezLook/Combobox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Listbox' using base type 'CEGUI/Listbox', window renderer 'Falagard/Listbox' and Look'N'Feel 'TaharezLook/Listbox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ListHeader' using base type 'CEGUI/ListHeader', window renderer 'Falagard/ListHeader' and Look'N'Feel 'TaharezLook/ListHeader'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ListHeaderSegment' using base type 'CEGUI/ListHeaderSegment', window renderer 'Falagard/ListHeaderSegment' and Look'N'Feel 'TaharezLook/ListHeaderSegment'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/MultiColumnList' using base type 'CEGUI/MultiColumnList', window renderer 'Falagard/MultiColumnList' and Look'N'Feel 'TaharezLook/MultiColumnList'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Slider' using base type 'CEGUI/Slider', window renderer 'Falagard/Slider' and Look'N'Feel 'TaharezLook/Slider'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/SliderThumb' using base type 'CEGUI/Thumb', window renderer 'Falagard/Button' and Look'N'Feel 'TaharezLook/SliderThumb'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ScrollablePane' using base type 'CEGUI/ScrollablePane', window renderer 'Falagard/ScrollablePane' and Look'N'Feel 'TaharezLook/ScrollablePane'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Spinner' using base type 'CEGUI/Spinner', window renderer 'Falagard/Default' and Look'N'Feel 'TaharezLook/Spinner'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Tooltip' using base type 'CEGUI/Tooltip', window renderer 'Falagard/Tooltip' and Look'N'Feel 'TaharezLook/Tooltip'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/StaticImage' using base type 'DefaultWindow', window renderer 'Falagard/StaticImage' and Look'N'Feel 'TaharezLook/StaticImage'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/StaticText' using base type 'DefaultWindow', window renderer 'Falagard/StaticText' and Look'N'Feel 'TaharezLook/StaticText'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ItemListbox' using base type 'CEGUI/ItemListbox', window renderer 'Falagard/ItemListbox' and Look'N'Feel 'TaharezLook/ItemListbox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/ListboxItem' using base type 'CEGUI/ItemEntry', window renderer 'Falagard/ItemEntry' and Look'N'Feel 'TaharezLook/ListboxItem'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/GroupBox' using base type 'CEGUI/GroupBox', window renderer 'Falagard/Default' and Look'N'Feel 'TaharezLook/GroupBox'. (002ED348)
06/03/2009 11:18:54 (Std)    Creating falagard mapping for type 'TaharezLook/Tree' using base type 'CEGUI/Tree', window renderer 'Falagard/Tree' and Look'N'Feel 'TaharezLook/Tree'. (002ED348)
06/03/2009 11:18:56 (Std)    Attempting to create Imageset 'Commonwealth-10_auto_glyph_images_ ' with texture only.

Posted: Fri Mar 06, 2009 09:42
by CrazyEddie
Hi, and welcome :)

I believe this type of issue is normally related to project configuration.

Check that you're linking the correct libs for each configuration (and only those libs, do not link both debug and release libs at the same time ;)) - so the static ones for static builds, the ones with the _d suffix for debug builds and so on.

HTH

CE.

Posted: Fri Mar 06, 2009 10:00
by Icewave
I have tripple check this just to be sure but i am using the correct libs (compiled with both 'Release' and 'Debug' modes, not static ect) and the libs are being used in the right modes... im posting screen shots in case im doing something wrong and i dont know it

Image
Image
no idea what atls is, just noticed it... removed it but it didn't make any difference....


Am i right in thinking that the drag, resize and minimize functions on the window by default are events? if thats true then i wonder why mine custom events crash...

All the demo files compile and run perfectly :cry:

edit:
Some how ive managed to remove all the library ignores, i dont know how it never used to compile if they were there.. but even so, it still gives the same errors

edit2: I managed to screw around wit the project setting enough to get the game to compile and run in debug mode(and yes its till using debug runtimes), but i get that assertion error

Code: Select all

fWnd->subscribeEvent(FrameWindow::EventMouseEnters, Event::Subscriber(&GUIManager::DisableCamera, this));

What dose the 'this' in this line for anyway? just thinking here...

Posted: Fri Mar 06, 2009 13:26
by CrazyEddie
Hi,

Yes, the demos and the system in general use the same types of event mechanisms internally as what you would use in your own apps as a user of the library.

If the demo apps built and ran, it definitely indicates either a coding error or a project setup / configuration issue - although identifying specifically what is messed is apparently easier said than done.

The assert is '!ms_Singleton' which is the check done before instantiation; so it may indicate either that you're creating singleton objects more than once, or there is a memory issue. IIRC Jamarr had an issue caused by having modified the structure alignment setting.

Another thing to check is that the c/c++ runtime being used is the correct one. That being the multithreaded DLL version, and obviously the debug version of that for debug builds.

The 'this' pointer in the Event::Subscriber is a pointer to an instance of the class that contains the member function you want called; this is required because you obviously need an instance pointer in order to be able to invoke a member function (also of note is that the object instance passed must not be deleted while the event may still get fired and the handler called).

CE

Posted: Fri Mar 06, 2009 14:23
by Icewave
If all events use the same mechanisms then i wonder why all the internally defined events work fine but the ones i try to define manually fail, very interesting

i tried changing the preprocesser def's but that didn't help either

Is there any way around this? is there a way i can add an event without calling 'subscribeEvent'? or perhaps is the location in my code that im calling that from (but ive tried it in two places... not sure)

Ive tried all 4 different run time library's (/MD /MT /MTd /MDd) all 4 of them crash in almost the same way

/MDd = Assertion error;
/MTd = (wont compile) > Strange... used to be able to compile this
/MD = Assertion error;
/MT = Assertion error;


and whats even strainger, is i cant get to to crash in call anymore... so i guess changing them preprocesser devs have helped a little but wtf is with this assertion error

Posted: Fri Mar 06, 2009 14:42
by CrazyEddie
Is there any way around this?

Yes, of course there is a way around it, since lots of people use the events system every day without issue ;)

I have only a handful of ideas about why you might get the issue you are; unfortunately, and especially with limited information as is always the case with this kind of 'remote' support, I do not always have all the answers to every possible problem.

Do you / are you able to get the assertion failure in debug mode? What does the call stack look like when that happens?

CE

Posted: Fri Mar 06, 2009 14:50
by Icewave
Yes, i can get the assertion failure in debug, and the call stack is completely blank

Code: Select all

   using namespace CEGUI;

   IDirect3DDevice9* Device = dbGetDirect3DDevice();
   DirectX9Renderer* MyRender = new DirectX9Renderer(Device, 0);
   new System( MyRender );

   DefaultResourceProvider* rp = static_cast<DefaultResourceProvider*>(System::getSingleton().getResourceProvider());
   rp->setResourceGroupDirectory("schemes", "./data/GUI/schemes/");
   rp->setResourceGroupDirectory("imagesets",    "./data/GUI/imagesets/");
   rp->setResourceGroupDirectory("fonts",       "./data/GUI/fonts/");
   rp->setResourceGroupDirectory("layouts",    "./data/GUI/layouts/");
   rp->setResourceGroupDirectory("looknfeels", "./data/GUI/looknfeel/");
   rp->setResourceGroupDirectory("lua_scripts", "./data/GUI/lua_scripts/");
   Imageset::setDefaultResourceGroup("imagesets");
   Scheme::setDefaultResourceGroup("schemes");
   Font::setDefaultResourceGroup("fonts");
   WidgetLookManager::setDefaultResourceGroup("looknfeels");
   WindowManager::setDefaultResourceGroup("layouts");
   ScriptModule::setDefaultResourceGroup("lua_scripts");
   SchemeManager::getSingleton().loadScheme("TaharezLook.scheme", "schemes");

   WindowManager& wmgr = WindowManager::getSingleton();
   Window* MyRoot = wmgr.createWindow("DefaultWindow", "root");
   System::getSingleton().setGUISheet( MyRoot );

   FrameWindow* fWnd = (FrameWindow*)wmgr.createWindow("TaharezLook/FrameWindow", "testWindow");
   MyRoot->addChildWindow(fWnd);
   fWnd->setText( "Hello World!" );
   fWnd->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );
   fWnd->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );   
   fWnd->subscribeEvent(FrameWindow::EventMouseEnters, Event::Subscriber(&GUIManager::DisableCamera, this));


is what im currently using. The assertion error only happens when i guess it attempts to call the function thats subscribed(without any call stack info its hard to know)

perhaps i should try a different compiler? do you have any recommendations?


edit:

Code: Select all

bool GUIManager::DisableCamera(const CEGUI::EventArgs &args)
{
   sMain->InterfaceActive = true;
   return true;
}

This looks right to me...

Posted: Fri Mar 06, 2009 15:38
by Icewave
:shock:

Ok i moved all the gui functions to the main function called a the begining of the game and shut down the rest of my game... and ... it works

i think i understand the assertion error... tell me
Dose it expect that GUIManager should be a singleton? dose it expect GUIManager::getSingleton() to exist if so then that explains everthing

Simple fix, ive taken all my gui code out of a class, and just moved it to global functions.


Thank you for all your help Eddie.

Posted: Fri Mar 06, 2009 17:16
by Jamarr
Based on the assert message I would say the problem is pretty obvious. You are calling the constructor of one of CEGUI's singleton classes twice (my guess is CEGUI::System).

The assert message gives you the file and line#, so you should be able to find/recognize this yourself as CEGUI is open-source. The assert is being generated because ms_Singleton is already defined (you have already created the object) and you are trying to create it again.

Btw, did you delibratly turn on asserts in a Release Build? They are normally only compiled in for debug-builds.

I would guess that you are calling your GUIManager::CreateGUI() function multiple times? In most cases you should only need to create/initialize CEGUI once.

I am guessing the reason it works when you moved the call into your main function is because that code is only ever executed once.

Posted: Fri Mar 06, 2009 17:56
by Icewave
You see, that's what i thought at first, i thought that it was being called more then once, but went through the code line by line to make sure i wasn't...

if it was it wold make more seance that the game would crash on load, as apposed to when the event is triggered

No i didn't enable asserts manually they were just already active i guess..



i know this is not how the 'this' pointer is suppose to behave... but is it possible that the 'this' pointer in the function call is somehow managing to recall GUIManager::CreateGUI()? perhaps i should try changing it from 'this' to 'GUIManager'... but ill try that tomorrow for now, im off to bed haha

Posted: Fri Mar 06, 2009 19:33
by Jamarr
Icewave wrote:You see, that's what i thought at first, i thought that it was being called more then once, but went through the code line by line to make sure i wasn't...


Well, the assert is definitely not wrong. It is being thrown because that is what is happening. The CEGUI::Singleton constructor is being called, the assert triggers because the singleton-pointer, ms_Singleton, has some value already assigned to it. This means either 1) the object has already been created legitly or 2) you either have a corrupt pointer or you are corrupting the heap somewhere.

if it was it wold make more seance that the game would crash on load, as apposed to when the event is triggered


There seems to be some conflicting issues here. Is the assertion triggered when subscribing to the event, or when the event is fired? In your original post, in debug mode it sounds like the assert is being triggered when you subscribe, but in release mode it is not triggered until the event is fired? What's the deal?

Either way, neither of those actions have anything to do with constructing a CEGUI::Singleton. You are either calling CreateGUI() twice, either during load or when an event is fired, or you are corrupting the heap and overwriting some memory that is causing CEGUI::Singleton() to be called.

Have you tried putting a try/catch block around all of the CEGUI calls that can throw exceptions? I do not see any in your code snippets. Typically these would be listed in the log, but you should really try to catch any/all exceptions regardless.

I would also highly recommend creating a log for your own code, so you know exactly what events are taking place and in what order.

No i didn't enable asserts manually they were just already active i guess..


Yeah, I looked at CEGUI's source and they use the assert() method directly instead of the assert macros for some reason...

i know this is not how the 'this' pointer is suppose to behave... but is it possible that the 'this' pointer in the function call is somehow managing to recall GUIManager::CreateGUI()? perhaps i should try changing it from 'this' to 'GUIManager'... but ill try that tomorrow for now, im off to bed haha


This is unlikely. When you pass 'this' to the subscription method, you are just passing a pointer to the class (in otherwords, a pointer to GUIManager). CEGUI uses this pointer to call the supplied method, DisableCamera. If the 'this' pointer where getting corrupted, you would most likely get an exception when CEGUI actually tries to call GUIManager::DisableCamera; though it may theoretically be possible. Also, if the pointer to DisableCamera got corrupted, it could have changed to point to CreateGUI though that is also probably unlikely.

I'm not sure if this will help shed any light on the issue, but you may want to try adding this code right before creating CEGUI:

Code: Select all

new CEGUI::DefaultLogger();
CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Insane);
CEGUI::Logger::getSingleton().setLogFilename("CEGUI.log");


This will push out a lot more information to the CEGUI.log file. And again, I would recommend adding logging into your own code so you can see exactly what/when/how your code is executing.

Posted: Sat Mar 07, 2009 03:10
by Icewave
I'v solved it..


calling GUIMananger::DisableCamera() was my mistake...
doing that recalls the GUIManager class constructor, and doing so recalls CreateGUI(); Im not sure how but the restriction that stops GUIManager from being started more then once failed. Faulty constructor code, my singleton's were not single, they were double.. fixing that fixed everything(i didn't code the constructor my partner did... lol... he couldn't stop laughing when i told him what he did wrong)

i should have been calling GUIManager::Instance()->DisableCamera()

what a stupid mistake i feel so stupid now... haha

Thanks for your advice Jamarr, the logging is what helped me find it(my logging not CEGUI's)

Posted: Sat Mar 07, 2009 17:58
by Jamarr
Glad you solved it.

Logging is a huge time/life saver when you have to debug a release build. Even a debug build if you are not getting any useful information out of the backtrace, which for some reason you where not. That should be pretty rare though; usually only happens if you've corrupted the heap.

Now, if I could just find the time to add logging into current the apps I've been working on this past year! lol :oops:

Posted: Sun Mar 08, 2009 09:33
by CrazyEddie
I agree that logging (or otherwise printing diagnostic messages somewhere) is a highly useful tool, in many instances even more useful than the debugger itself. Anyone who hasn't or doesn't do this when developing and debugging their software is surely missing out on a valuable source of information regarding the execution of their program(s) :)

I too have spent hours trying to track down an issue, only to solve it in 30 seconds after adding some code to print diagnostic output. And yes, I still sometimes fall into the mistake of not doing that from the start :P

CE.