fix infinite recursion in case of non-DAG documents
This commit is contained in:
@@ -165,6 +165,20 @@ private:
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class StateLocker
|
||||
{
|
||||
public:
|
||||
StateLocker(bool& flag, bool st = true) : lock(flag), state(st)
|
||||
{ lock = state; }
|
||||
~StateLocker()
|
||||
{ lock = !state; }
|
||||
private:
|
||||
bool& lock;
|
||||
bool state;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ConnectionBlocker {
|
||||
typedef boost::BOOST_SIGNALS_NAMESPACE::connection Connection;
|
||||
bool b;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "Command.h"
|
||||
#include "Application.h"
|
||||
#include "Document.h"
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/GroupExtension.h>
|
||||
@@ -43,7 +44,7 @@ using namespace Gui;
|
||||
|
||||
EXTENSION_PROPERTY_SOURCE(Gui::ViewProviderGroupExtension, Gui::ViewProviderExtension)
|
||||
|
||||
ViewProviderGroupExtension::ViewProviderGroupExtension() : visible(false)
|
||||
ViewProviderGroupExtension::ViewProviderGroupExtension() : visible(false), guard(false)
|
||||
{
|
||||
initExtensionType(ViewProviderGroupExtension::getExtensionClassTypeId());
|
||||
}
|
||||
@@ -116,6 +117,11 @@ std::vector< App::DocumentObject* > ViewProviderGroupExtension::extensionClaimCh
|
||||
|
||||
void ViewProviderGroupExtension::extensionShow(void) {
|
||||
|
||||
// avoid possible infinite recursion
|
||||
if (guard)
|
||||
return;
|
||||
Base::StateLocker lock(guard);
|
||||
|
||||
// when reading the Visibility property from file then do not hide the
|
||||
// objects of this group because they have stored their visibility status, too
|
||||
if (!getExtendedViewProvider()->isRestoring() && !this->visible) {
|
||||
@@ -136,6 +142,11 @@ void ViewProviderGroupExtension::extensionShow(void) {
|
||||
|
||||
void ViewProviderGroupExtension::extensionHide(void) {
|
||||
|
||||
// avoid possible infinite recursion
|
||||
if (guard)
|
||||
return;
|
||||
Base::StateLocker lock(guard);
|
||||
|
||||
// when reading the Visibility property from file then do not hide the
|
||||
// objects of this group because they have stored their visibility status, too
|
||||
if (!getExtendedViewProvider()->isRestoring() && this->visible) {
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
|
||||
private:
|
||||
bool visible; // helper variable
|
||||
bool guard;
|
||||
std::vector<ViewProvider*> nodes;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user