Skip to content

Commit 91b1785

Browse files
committed
Fix crash if multiple multiline text edtit widgets for the same field are shown
Fix #11813
1 parent acd003e commit 91b1785

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/gui/editorwidgets/qgstexteditwrapper.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,27 +119,33 @@ void QgsTextEditWrapper::initWidget( QWidget* editor )
119119
}
120120
}
121121

122-
void QgsTextEditWrapper::setValue( const QVariant& value )
122+
void QgsTextEditWrapper::setValue( const QVariant& val )
123123
{
124124
QString v;
125-
if ( value.isNull() )
125+
if ( val.isNull() )
126126
{
127127
if ( !( field().type() == QVariant::Int || field().type() == QVariant::Double || field().type() == QVariant::LongLong || field().type() == QVariant::Date ) )
128128
v = QSettings().value( "qgis/nullValue", "NULL" ).toString();
129129
}
130130
else
131-
v = value.toString();
131+
v = val.toString();
132132

133133
if ( mTextEdit )
134134
{
135-
if ( config( "UseHtml" ).toBool() )
136-
mTextEdit->setHtml( v );
137-
else
138-
mTextEdit->setPlainText( v );
135+
if ( val != value() )
136+
{
137+
if ( config( "UseHtml" ).toBool() )
138+
mTextEdit->setHtml( v );
139+
else
140+
mTextEdit->setPlainText( v );
141+
}
139142
}
140143

141144
if ( mPlainTextEdit )
142-
mPlainTextEdit->setPlainText( v );
145+
{
146+
if ( val != value() )
147+
mPlainTextEdit->setPlainText( v );
148+
}
143149

144150
if ( mLineEdit )
145151
mLineEdit->setText( v );

0 commit comments

Comments
 (0)