pierceblaylock
24-07-2008 15:29:46
I've searched the forum and noticed some other people talking about problems with this function too, but none of them ever seemed to be resolved.
Every time I try to call addEventHandler my application crashes with "test.exe has triggered a breakpoint" in the m_deallocator function of the MMGR.
Here is my code (I know this probably doesn't help and I also know this code isn't very defensive, but it is for illustrative purposes):
The call stack looks pretty much the same as what everyone else in the past has complained about so I'm guessing it is the same issue.
I have basically stripped my application down to a bare basic shell believing that something was corrupting the heap, but no dice. In fact, I can take a copy of the most basic ogre initialisation code using the ExampleListener and drop QuickGUI in with nothing but a single button and the problem still happens so there is no way something can be corrupting the heap.
I've triple checked all my initialization code to make sure everything looks the same as the tutorials and the demo app (while I'm on that topic, I can't even run the demo app... it too just crashes unexplainably, probably for the same reason).
After seeing other people having the same issue, I'm starting to think that there is a problem with QuickGUI. If there is heap corruption going on, then it maybe QuickGUI that is doing it. I can run 1000's of lines of code in my application without ever noticing any so called "heap corruption" issues until I call addEventHandler.
Every time I try to call addEventHandler my application crashes with "test.exe has triggered a breakpoint" in the m_deallocator function of the MMGR.
Here is my code (I know this probably doesn't help and I also know this code isn't very defensive, but it is for illustrative purposes):
QuickGUI::Sheet *sheet = gui->getDefaultSheet();
QuickGUI::Button *button = sheet->createButton();
button->setDimensions(QuickGUI::Rect(8,45,144,30));
button->setText("Test");
button->addEventHandler(QuickGUI::Widget::EVENT_MOUSE_BUTTON_UP,&TestApp::Test,this);
The call stack looks pretty much the same as what everyone else in the past has complained about so I'm guessing it is the same issue.
test.exe!m_deallocator(const char * sourceFile=0x00433fa8, const unsigned int sourceLine=0, const char * sourceFunc=0x00433fa8, const unsigned int deallocationType=6, const void * reportedAddress=0x033ca0d8) Line 1451 + 0xd bytes C++
test.exe!operator delete(void * reportedAddress=0x033ca0d8) Line 1009 + 0x25 bytes C++
test.exe!std::allocator<QuickGUI::MemberFunctionSlot *>::deallocate(QuickGUI::MemberFunctionSlot * * _Ptr=0x033ca0d8, unsigned int __formal=1) Line 141 + 0x9 bytes C++
test.exe!std::vector<QuickGUI::MemberFunctionSlot *,std::allocator<QuickGUI::MemberFunctionSlot *> >::_Insert_n(std::_Vector_iterator<QuickGUI::MemberFunctionSlot *,std::allocator<QuickGUI::MemberFunctionSlot *> > _Where=0xfdfdfdfd, unsigned int _Count=2, QuickGUI::MemberFunctionSlot * const & _Val=0x033caab0) Line 1160 C++
test.exe!std::vector<QuickGUI::MemberFunctionSlot *,std::allocator<QuickGUI::MemberFunctionSlot *> >::insert(std::_Vector_iterator<QuickGUI::MemberFunctionSlot *,std::allocator<QuickGUI::MemberFunctionSlot *> > _Where=0xfdfdfdfd, QuickGUI::MemberFunctionSlot * const & _Val=0x033caab0) Line 855 C++
test.exe!std::vector<QuickGUI::MemberFunctionSlot *,std::allocator<QuickGUI::MemberFunctionSlot *> >::push_back(QuickGUI::MemberFunctionSlot * const & _Val=0x033caab0) Line 800 + 0x2d bytes C++
test.exe!QuickGUI::Widget::addEventHandler<TestApp>(QuickGUI::Widget::Event EVENT=EVENT_MOUSE_BUTTON_UP, void (const QuickGUI::EventArgs &)* function=0x00411be5, TestApp* obj=0x025a97c0) Line 162 C++
test.exe!TestApp::Run() Line 201 C++
test.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x001e3733, HINSTANCE__ * __formal=0x00000000) Line 18 C++
test.exe!__tmainCRTStartup() Line 589 + 0x35 bytes C
test.exe!WinMainCRTStartup() Line 414 C
kernel32.dll!76a74911()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!77bfe4b6()
ntdll.dll!77bfe489()
I have basically stripped my application down to a bare basic shell believing that something was corrupting the heap, but no dice. In fact, I can take a copy of the most basic ogre initialisation code using the ExampleListener and drop QuickGUI in with nothing but a single button and the problem still happens so there is no way something can be corrupting the heap.
I've triple checked all my initialization code to make sure everything looks the same as the tutorials and the demo app (while I'm on that topic, I can't even run the demo app... it too just crashes unexplainably, probably for the same reason).
After seeing other people having the same issue, I'm starting to think that there is a problem with QuickGUI. If there is heap corruption going on, then it maybe QuickGUI that is doing it. I can run 1000's of lines of code in my application without ever noticing any so called "heap corruption" issues until I call addEventHandler.