Simple code that will recreate the crash, all you have to do is select the edit box and hit enter twice:
Code: Select all
#include <irrlicht.h>
#include <iostream>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif
class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver(IGUIEnvironment* Env) : env(Env) { }
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_GUI_EVENT)
{
switch(event.GUIEvent.EventType)
{
case EGET_EDITBOX_ENTER:
// On enter, remove the box
printf("\n%p\n", event.GUIEvent.Caller);
if (event.GUIEvent.Caller != NULL)
event.GUIEvent.Caller->remove();
break;
default:
break;
}
}
return false;
}
private:
IGUIEnvironment* env;
};
int main()
{
IrrlichtDevice * device = createDevice(EDT_SOFTWARE, core::dimension2d<s32>(640, 480));
printf("Select inside the edit box and hit enter, then hit enter again.");
if (device == 0)
return 1; // could not create selected driver.
device->setWindowCaption(L"Hit enter twice in text box to crash");
video::IVideoDriver* driver = device->getVideoDriver();
IGUIEnvironment* env = device->getGUIEnvironment();
/// Initially add device
env->addEditBox(L"Select and hit enter twice", rect<s32>(350, 80, 550, 100));
MyEventReceiver receiver(env);
device->setEventReceiver(&receiver);
while(device->run() && driver)
if (device->isWindowActive())
{
driver->beginScene(true, true, SColor(0,200,200,200));
env->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Output when done:
Code: Select all
Irrlicht Engine version 1.5
Microsoft Windows XP Personal Service Pack 3 (Build 2600)
Select inside the edit box and hit enter, then hit enter again.
009E9728
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
In irr::gui::CGUIEditBox::processKey () (C:\Program Files\CodeBlocks\MinGW\irrlicht-1.5\bin\Win32-gcc\Irrlicht.dll)
PS: The fix probably needs to be sure to NOT call EGET_ELEMENT_FOCUS_LOST, could cause problems in programs if they happen to remove elements when focus is lost.