Thanks for taking a look. Here's the full source of an example that causes a crash compiled against the latest trunk:
Code: Select all
#include "irrlicht.h"
using namespace irr;
using namespace irr::io;
using namespace irr::core;
using namespace irr::scene;
using namespace irr::gui;
using namespace video;
#define WINDOW_SIZE_X 640
#define WINDOW_SIZE_Y 480
#define DEVICE_BPP 32
static IrrlichtDevice* m_device;
static IVideoDriver* m_videoDriver;
static ISceneManager* m_sceneManager;
static IFileSystem* m_fileSystem;
static IEventReceiver* m_eventReceiver;
static IGUIEnvironment* m_gui;
static IGUIFont* m_defaultFont=0;
static IGUIFont* m_monoFont=0;
static ICameraSceneNode* m_camera;
static bool m_running=true;
static int m_capNumber=1;
static E_DRIVER_TYPE m_driverType=EDT_OPENGL;
IGUIEnvironment* getGUI()
{
return m_gui;
}
//-----------------------------------------------------------------------------
// E v e n t R e c e i v e r
//-----------------------------------------------------------------------------
class EventReceiver : public IEventReceiver
{
bool OnEvent(const SEvent& event)
{
if (event.EventType == irr::EET_KEY_INPUT_EVENT)
if( !event.KeyInput.PressedDown ) // key up?
{
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:
m_running = false;
return true;
default:
break;
}
}
return false;
}
public:
EventReceiver() : IEventReceiver() {}
};
//-----------------------------------------------------------------------------
// m a i n
//-----------------------------------------------------------------------------
#ifdef _IRR_WINDOWS_
#pragma comment(linker, "/subsystem:console /ENTRY:mainCRTStartup")
#endif
int main(int argc, char* argv[])
{
m_eventReceiver = new EventReceiver();
SIrrlichtCreationParameters cp;
cp.DriverType = m_driverType;
cp.WindowSize = dimension2du(WINDOW_SIZE_X,WINDOW_SIZE_Y);
cp.Bits = DEVICE_BPP;
cp.Fullscreen = false;
cp.Vsync = false;
cp.Stencilbuffer = false;
cp.AntiAlias = false;
cp.EventReceiver = m_eventReceiver;
cp.WindowId = 0;
m_device = createDeviceEx(cp);
if(!m_device)
return 1;
m_fileSystem = m_device->getFileSystem();
m_videoDriver = m_device->getVideoDriver();
m_sceneManager = m_device->getSceneManager();
m_gui = m_device->getGUIEnvironment();
//
// override default font
//
stringc defFonts = "defaults.zip";
m_defaultFont = 0;
if(m_fileSystem->existFile(defFonts.c_str()))
{
m_fileSystem->addZipFileArchive(defFonts.c_str());
m_defaultFont = m_gui->getFont("tdeffont.xml");
if(m_defaultFont)
{
m_defaultFont->grab();
m_gui->getSkin()->setFont(m_defaultFont);
}
}
if(!m_defaultFont)
printf("Error loading defaults.zip\n");
m_device->setWindowCaption(L"idebug");
m_camera = m_sceneManager->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
m_camera->setPosition(vector3df(0,10,0));
IGUIStaticText* stext = getGUI()->addStaticText(L" ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 ",
rect<s32>(50,200,350,225),false,false,0,true);
stext->setBackgroundColor(SColor(129,128,0,0));
stext->setOverrideColor(SColor(255,255,255,255));
while(m_device->run() && m_running)
{
m_videoDriver->beginScene(true, true, SColor(255,100,101,140));
m_sceneManager->drawAll();
m_gui->drawAll();
m_videoDriver->endScene();
}
if(m_defaultFont)
m_defaultFont->drop();
m_device->drop();
delete m_eventReceiver;
return 0;
}
Make sure the "defaults.zip" (includes custom font) file exists in the same directory as the executable and it's loaded by
addZipFileArchive().
The reason moving "!found" in front of xml->read() fixes the problem is that xml->read() isn't executed when "found" is set to true inside the loop. I suspect this may be related to the fairly recent tightening up of the xml reader source code.
Let me know if you need anything else.