From 9fd2f82a790ce1d0ef69db4534cbc8fe68062147 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 7 Dec 2017 13:23:48 +0300 Subject: [PATCH] Issue #2349 Fatal error when close window Hide faces --- src/XGUI/XGUI_FacesPanel.cpp | 12 +++++++----- src/XGUI/XGUI_FacesPanel.h | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/XGUI/XGUI_FacesPanel.cpp b/src/XGUI/XGUI_FacesPanel.cpp index 0c9124ff9..73e79adc9 100644 --- a/src/XGUI/XGUI_FacesPanel.cpp +++ b/src/XGUI/XGUI_FacesPanel.cpp @@ -84,7 +84,7 @@ void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) // restore previous view of presentations bool isModified = redisplayObjects(myItemObjects, false); std::set > aHiddenObjects = myHiddenObjects; - isModified = displayHiddenObjects(aHiddenObjects, false) || isModified; + isModified = displayHiddenObjects(aHiddenObjects, myHiddenObjects, false) || isModified; if (isModified && isToFlushRedisplay) Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); @@ -250,7 +250,8 @@ bool XGUI_FacesPanel::processDelete() } if (isModified) { bool isRedisplayed = redisplayObjects(aRestoredObjects, false); - isRedisplayed = displayHiddenObjects(aRestoredObjects, false) || isRedisplayed; + isRedisplayed = displayHiddenObjects(aRestoredObjects, myHiddenObjects, false) + || isRedisplayed; if (isRedisplayed) Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); // should be after flush of redisplay to have items object to be updated @@ -291,6 +292,7 @@ bool XGUI_FacesPanel::redisplayObjects( //******************************************************************** bool XGUI_FacesPanel::displayHiddenObjects( const std::set >& theObjects, + std::set >& theHiddenObjects, const bool isToFlushRedisplay) { if (theObjects.empty()) @@ -304,9 +306,9 @@ bool XGUI_FacesPanel::displayHiddenObjects( { ObjectPtr anObject = *anIt; // if the object was hidden by this panel - if (anObject->isDisplayed() || myHiddenObjects.find(anObject) == myHiddenObjects.end()) + if (anObject->isDisplayed() || theHiddenObjects.find(anObject) == theHiddenObjects.end()) continue; - myHiddenObjects.erase(anObject); + theHiddenObjects.erase(anObject); anObject->setDisplayed(true); // it means that the object is hidden by hide all faces ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent); isModified = true; @@ -461,7 +463,7 @@ void XGUI_FacesPanel::onTransparencyChanged() bool isModified = false; if (useTransparency()) { std::set > aHiddenObjects = myHiddenObjects; - isModified = displayHiddenObjects(aHiddenObjects, false); + isModified = displayHiddenObjects(aHiddenObjects, myHiddenObjects, false); } else isModified = hideEmptyObjects(); diff --git a/src/XGUI/XGUI_FacesPanel.h b/src/XGUI/XGUI_FacesPanel.h index 8b5d71a6b..1dca0a9b0 100644 --- a/src/XGUI/XGUI_FacesPanel.h +++ b/src/XGUI/XGUI_FacesPanel.h @@ -148,15 +148,17 @@ private: /// \param theObjects container of objects /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly /// \return true if some of objects was redisplayed - bool redisplayObjects(const std::set >& theObjects, - const bool isToFlushRedisplay); + static bool redisplayObjects(const std::set >& theObjects, + const bool isToFlushRedisplay); /// Display objects if the objects are in a container of hidden by this pane. /// \param theObjects container of objects + /// \param theHiddenObjects hidden objects, if object is in the container, it should be removed /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly /// \return true if some of objects was redisplayed - bool displayHiddenObjects(const std::set >& theObjects, - const bool isToFlushRedisplay); + static bool displayHiddenObjects(const std::set >& theObjects, + std::set >& theHiddenObjects, + const bool isToFlushRedisplay); /// Iterates by items and hide objects where all sub-shapes are hidden /// \return true if some of objects was redisplayed -- 2.39.2