From 5962caf6aa8d2ee617ec8d42f037b535f144d97c Mon Sep 17 00:00:00 2001 From: cutealien Date: Fri, 28 Oct 2016 10:17:35 +0000 Subject: [PATCH] Merge branch releases/1.8 revisions r5326:r5346 into trunk. - Fix crash in eventhandling when calling remove() on a contextmenu while it has focus. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5347 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 3 ++- source/Irrlicht/CGUIContextMenu.cpp | 31 ++++++++++++++++------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/changes.txt b/changes.txt index 9f863295..4d18bf33 100644 --- a/changes.txt +++ b/changes.txt @@ -156,6 +156,7 @@ should now be fps independentn -------------------------- Changes in 1.8.5 + - Fix crash in eventhandling when calling remove() on a contextmenu while it has focus. - CImageLoaderJPG::isALoadableFileFormat uses a test which allows to load more jpg formats (for example uncompressed jpg's). Thx @Yaron Cohen-Tal for report, test-image and his help with the patch. -------------------------- @@ -251,7 +252,7 @@ Changes in 1.8 (7.11.2012) - quaternion conversions to and from matrix4 no longer invert rotations. To test if your code was affected by this you can set IRR_TEST_BROKEN_QUATERNION_USE in quaternion.h and try to compile your application. - Then on all compile-errors when you pass the matrix to the quaternion you can replace the matrix transposed matrix. + Then on all compile-errors when you pass the matrix to the quaternion you can replace the matrix with the transposed matrix. For all errors you get on getMatrix() you can use quaternion::getMatrix_transposed instead. - CGUIEnvironment::loadGui - loading a gui into a target-element no longer messes up when the gui-file contained guienvironment serialization. diff --git a/source/Irrlicht/CGUIContextMenu.cpp b/source/Irrlicht/CGUIContextMenu.cpp index c46838cd..b7452db3 100644 --- a/source/Irrlicht/CGUIContextMenu.cpp +++ b/source/Irrlicht/CGUIContextMenu.cpp @@ -285,22 +285,25 @@ bool CGUIContextMenu::OnEvent(const SEvent& event) { // set event parent of submenus IGUIElement * p = EventParent ? EventParent : Parent; - setEventParent(p); - - SEvent event; - event.EventType = EET_GUI_EVENT; - event.GUIEvent.Caller = this; - event.GUIEvent.Element = 0; - event.GUIEvent.EventType = EGET_ELEMENT_CLOSED; - if ( !p->OnEvent(event) ) + if ( p ) // can be 0 when element got removed already { - if ( CloseHandling & ECMC_HIDE ) + setEventParent(p); + + SEvent event; + event.EventType = EET_GUI_EVENT; + event.GUIEvent.Caller = this; + event.GUIEvent.Element = 0; + event.GUIEvent.EventType = EGET_ELEMENT_CLOSED; + if ( !p->OnEvent(event) ) { - setVisible(false); - } - if ( CloseHandling & ECMC_REMOVE ) - { - remove(); + if ( CloseHandling & ECMC_HIDE ) + { + setVisible(false); + } + if ( CloseHandling & ECMC_REMOVE ) + { + remove(); + } } }