Skip to content
Permalink
Browse files

Merge pull request #7888 from signedav/bugfix_recursive_crash

[Bugfix] Do not store recursively
  • Loading branch information
m-kuhn committed Oct 3, 2018
2 parents 2aef195 + dcca348 commit 09adbe290b69b44b426985a10d3fedebbaeea3a4
Showing with 15 additions and 3 deletions.
  1. +15 −3 src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp
@@ -19,7 +19,6 @@
#include "qgsattributeeditorcontext.h"
#include "qgsproject.h"
#include "qgsrelationmanager.h"

#include <QWidget>

QgsRelationWidgetWrapper::QgsRelationWidgetWrapper( QgsVectorLayer *vl, const QgsRelation &relation, QWidget *editor, QWidget *parent )
@@ -48,9 +47,23 @@ void QgsRelationWidgetWrapper::setVisible( bool visible )

void QgsRelationWidgetWrapper::aboutToSave()
{
if ( !mRelation.isValid() || !widget() || !widget()->isVisible() )
if ( !mRelation.isValid() || !widget() || !widget()->isVisible() || mRelation.referencingLayer() == mRelation.referencedLayer() )
return;

// If the layer is already saved before, return
const QgsAttributeEditorContext *ctx = &context();
do
{
if ( ctx->relation().isValid() && ( ctx->relation().referencedLayer() == mRelation.referencingLayer()
|| ( mNmRelation.isValid() && ctx->relation().referencedLayer() == mNmRelation.referencedLayer() ) )
)
{
return;
}
ctx = ctx->parentContext();
}
while ( ctx );

// Calling isModified() will emit a beforeModifiedCheck()
// signal that will make the embedded form to send any
// outstanding widget changes to the edit buffer
@@ -126,7 +139,6 @@ void QgsRelationWidgetWrapper::initWidget( QWidget *editor )
}
while ( ctx );


w->setRelations( mRelation, mNmRelation );

mWidget = w;

0 comments on commit 09adbe2

Please sign in to comment.
You can’t perform that action at this time.