From 4a5a8ef7f40637520a7ce922b8df44c85eab6079 Mon Sep 17 00:00:00 2001 From: cutealien Date: Sun, 19 Sep 2010 21:11:39 +0000 Subject: [PATCH] Bugfix: don't clear cursors in linux-device after the display has been closed already. Fixes crashes on application shutdown with more than one device. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3418 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/CIrrDeviceLinux.cpp | 8 +++++++- source/Irrlicht/CIrrDeviceLinux.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp index 0cc634ce..2193d7ba 100644 --- a/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/source/Irrlicht/CIrrDeviceLinux.cpp @@ -136,6 +136,7 @@ CIrrDeviceLinux::~CIrrDeviceLinux() XFree(StdHints); // Disable cursor (it is drop'ed in stub) CursorControl->setVisible(false); + static_cast(CursorControl)->clearCursors(); if (display) { #ifdef _IRR_COMPILE_WITH_OPENGL_ @@ -2095,6 +2096,12 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null) } CIrrDeviceLinux::CCursorControl::~CCursorControl() +{ + // Do not clearCursors here as the display is already closed + // TODO (cutealien): droping cursorcontrol earlier might work, not sure about reason why that's done in stub currently. +} + +void CIrrDeviceLinux::CCursorControl::clearCursors() { for ( u32 i=0; i < Cursors.size(); ++i ) { @@ -2105,7 +2112,6 @@ CIrrDeviceLinux::CCursorControl::~CCursorControl() } } - #ifdef _IRR_COMPILE_WITH_X11_ void CIrrDeviceLinux::CCursorControl::initCursors() { diff --git a/source/Irrlicht/CIrrDeviceLinux.h b/source/Irrlicht/CIrrDeviceLinux.h index c6ea3cda..cda69073 100644 --- a/source/Irrlicht/CIrrDeviceLinux.h +++ b/source/Irrlicht/CIrrDeviceLinux.h @@ -294,6 +294,7 @@ namespace irr #ifdef _IRR_COMPILE_WITH_X11_ void update(); + void clearCursors(); #endif private: