I code a EventReceiver like in Tutorial 05.UserInterface. I compiled it without errors and execute it (using Dev C++). First it works but than I get this Windows Error Message (An error has occured. Please send a bug report to Microsoft and so on, I think you know it).
By using the Debugger I get a Segmentation Fault. The Debugger didn't show a position but if I set the comments before switch and after device->closeDevice() the error didn't occurs (but it didn't work, of course). Where is my mistake?
Code: Select all
bool DriverTypeReceiver::OnEvent(SEvent event){
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
if(event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED){
s32 s=listbox->getSelected();
/*switch(s){ //<-error without coment
case 0:
driverType=video::EDT_DIRECTX9;
break;
case 1:
driverType=video::EDT_DIRECTX8;
break;
case 2:
driverType=video::EDT_OPENGL;
break;
}
device->closeDevice();*/ //<-error without coment
return true;
}
}
return false;
};
PS: I'm sorry for my english, it's only my second language, my first one is german.