Yeah, the event subscriber line is the specific line it crashes on. I tried Step Over once I got to it, but it crashed when I did so.
I'll do my best to accurately describe what happens when I 'Step Into' starting with the breakpoint at the event subscriber line.
1. Breakpoint
Code: Select all
FileNew->subscribeEvent(MenuItem::EventClicked, Event::Subscriber(&Interface::TestFunction, this));
2. Step Into (to templatised subscriberslot constructor)
Code: Select all
template<typename T>
SubscriberSlot(bool (T::*function)(const EventArgs&), T* obj) :
d_functor_impl(new MemberFunctionSlot<T>(function, obj))
{}
3. Step Into (to MemberFunctionSlot constructor)
Code: Select all
MemberFunctionSlot(MemberFunctionType func, T* obj) :
d_function(func),
d_object(obj)
{}
4. Step Into (back to templatised subscriberslot constructor)
Code: Select all
template<typename T>
SubscriberSlot(bool (T::*function)(const EventArgs&), T* obj) :
d_functor_impl(new MemberFunctionSlot<T>(function, obj))
{}
5. Step Into (back to event subscription)
Code: Select all
FileNew->subscribeEvent(MenuItem::EventClicked, Event::Subscriber(&Interface::TestFunction, this));
Now when I 'Step Into' once more (starting back on the event subscription line) it crashes with the Access Violation. I cannot Step Over here, either.
So I think that means that my Event::Subscriber() goes fine, but calling the subscribeEvent with those arguments crashes?
Here is what happens if I view the Disassembly starting after the 5th Step Into (when the next Step Into would crash):
Code: Select all
00420D7D mov dword ptr [ebp-2740h],eax
00420D83 mov eax,dword ptr [ebp-2740h]
00420D89 mov dword ptr [ebp-2744h],eax
00420D8F mov dword ptr [ebp-4],0Fh
00420D96 mov esi,esp
00420D98 mov ecx,dword ptr [ebp-2744h]
00420D9E mov edx,dword ptr [ecx]
00420DA0 push edx
00420DA1 mov eax,dword ptr [__imp_CEGUI::MenuItem::EventClicked (440570h)]
00420DA6 push eax
00420DA7 lea ecx,[ebp-1F64h]
00420DAD push ecx
00420DAE mov ecx,dword ptr [ebp-5Ch]
00420DB1 add ecx,20h
00420DB4 mov edx,dword ptr [ebp-5Ch]
00420DB7 mov eax,dword ptr [edx+20h]
00420DBA mov edx,dword ptr [eax+8]
It starts at the first line and crashes on the last.
I'll do my best to look at this myself, but my knowledge of assembly is mostly limited to changing JNZ's and JMP's in programs for nefarious purposes
Rackle: As you requested, here is the entirety of the InitWidgets() function, if you still want to see it. I left in all code for completeness' sake. Also included is the referenced member function.
Code: Select all
void Interface::InitWidgets()
{
WindowManager& wmgr = WindowManager::getSingleton(); // Init pointer to Window Manager
Window* Root = wmgr.createWindow("DefaultWindow", "root"); // Create root window
System::getSingleton().setGUISheet(Root); // Set root window
Window* Menubar = wmgr.createWindow("WindowsLook/Menubar", "root/menubar");
Menubar->setSize(UVector2(cegui_reldim(1.0f), cegui_reldim(0.06f)));
Menubar->setAlwaysOnTop(true);
Root->addChildWindow(Menubar);
MenuItem* File = static_cast<MenuItem*>(wmgr.createWindow("WindowsLook/MenuItem", "root/menubar/file"));
File->setText("File");
Menubar->addChildWindow(File);
PopupMenu* FilePopup = static_cast<PopupMenu*>(wmgr.createWindow("WindowsLook/PopupMenu", "root/menubar/file/popup"));
File->addChildWindow(FilePopup);
MenuItem* FileNew = static_cast<MenuItem*>(wmgr.createWindow("WindowsLook/MenuItem", "root/menubar/file/popup/new"));
FileNew->setText("New");
FilePopup->addChildWindow(FileNew);
FileNew->subscribeEvent(MenuItem::EventClicked, Event::Subscriber(&Interface::TestFunction, this));
MenuItem* FileOpen = static_cast<MenuItem*>(wmgr.createWindow("WindowsLook/MenuItem", "root/menubar/file/popup/open"));
FileOpen->setText("Open");
FilePopup->addChildWindow(FileOpen);
MenuItem* FileSave = static_cast<MenuItem*>(wmgr.createWindow("WindowsLook/MenuItem", "root/menubar/file/popup/save"));
FilePopup->addChildWindow(FileSave);
FileSave->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim(0.05f)));
FileSave->setText("Save");
MenuItem* FileExit = static_cast<MenuItem*>(wmgr.createWindow("WindowsLook/MenuItem", "root/menubar/file/popup/exit"));
FilePopup->addChildWindow(FileExit);
FileExit->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim(0.05f)));
FileExit->setText("Exit");
Window* View = wmgr.createWindow("WindowsLook/MenuItem", "root/menubar/view");
Menubar->addChildWindow(View);
View->setText("View");
PopupMenu* ViewPopup = static_cast<PopupMenu*>(wmgr.createWindow("WindowsLook/PopupMenu", "root/menubar/view/popup"));
View->addChildWindow(ViewPopup);
ViewPopup->setSize(UVector2(cegui_reldim(2.5f), cegui_reldim(5.5f)));
MenuItem* ViewFullscreen = static_cast<MenuItem*>(wmgr.createWindow("WindowsLook/MenuItem", "root/menubar/view/popup/fullscreen"));
ViewPopup->addChildWindow(ViewFullscreen);
ViewFullscreen->setText("Toggle Fullscreen");
TabControl* Tabs = static_cast<TabControl*>(wmgr.createWindow("WindowsLook/TabControl", "root/tabs"));
Root->addChildWindow(Tabs);
Tabs->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim(0.94f)));
Tabs->setPosition(UVector2(cegui_reldim(0.8f),cegui_reldim(0.06f)));
Window* TabTiles = wmgr.createWindow("DefaultWindow", "root/tabs/tiles");
TabTiles->setText("Tiles");
Tabs->addChildWindow(TabTiles);
Window* TabObjects = wmgr.createWindow("DefaultWindow", "root/tabs/objects");
TabObjects->setText("Objects");
TabControl* ObjectsTabs = static_cast<TabControl*>(wmgr.createWindow("WindowsLook/TabControl","root/tabs/objectstabs"));
TabObjects->addChildWindow(ObjectsTabs);
ObjectsTabs->setSize(UVector2(cegui_reldim(1.0f), cegui_reldim(1.0f)));
ObjectsTabs->setPosition(UVector2(cegui_reldim(0.0f),cegui_reldim(0.0f)));
Window* ObjectsTabStatics = wmgr.createWindow("DefaultWindow", "root/tabs/objects/statics");
ObjectsTabStatics->setText("Statics");
ObjectsTabs->addChildWindow(ObjectsTabStatics);
Window* ObjectsTabDynamics = wmgr.createWindow("DefaultWindow", "root/tabs/objects/dynamics");
ObjectsTabDynamics->setText("Dynamics");
ObjectsTabs->addChildWindow(ObjectsTabDynamics);
Tabs->addChildWindow(TabObjects);
Window* TabBeings = wmgr.createWindow("DefaultWindow", "root/tabs/beings");
TabBeings->setText("Beings");
TabControl* BeingsTabs = static_cast<TabControl*>(wmgr.createWindow("WindowsLook/TabControl","root/tabs/beingstabs"));
TabBeings->addChildWindow(BeingsTabs);
BeingsTabs->setSize(UVector2(cegui_reldim(1.0f),cegui_reldim(1.0f)));
BeingsTabs->setPosition(UVector2(cegui_reldim(0.0f),cegui_reldim(0.0f)));
Window* BeingsTabEnemies = wmgr.createWindow("DefaultWindow", "root/tabs/beings/enemies");
BeingsTabEnemies->setText("Enemies");
BeingsTabs->addChildWindow(BeingsTabEnemies);
Window* BeingsTabNPCs = wmgr.createWindow("DefaultWindow", "root/tabs/beings/npcs");
BeingsTabNPCs->setText("NPCs");
BeingsTabs->addChildWindow(BeingsTabNPCs);
Tabs->addChildWindow(TabBeings);
}
bool Interface::TestFunction(const CEGUI::EventArgs &args)
{
return true;
}
I haven't checked if the TabControl part is still working since I started using the new CEGUI version, but it doesn't get their regardless.