Skip to content

Commit

Permalink
Do not delete the clear action (and don't crash)
Browse files Browse the repository at this point in the history
Fix #20180 - Tracing with Offset produces QGIS Crash

The crash was deep inside Qt and I couldn't really debug it,
the solution I'm proposing looks way too easy, but
apparently it just works.
  • Loading branch information
elpaso committed Oct 22, 2018
1 parent dfb28fe commit 5c28693
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/gui/qgsfilterlineedit.cpp
Expand Up @@ -37,6 +37,7 @@ QgsFilterLineEdit::QgsFilterLineEdit( QWidget *parent, const QString &nullValue

connect( this, &QLineEdit::textChanged, this,
&QgsFilterLineEdit::onTextChanged );

}

void QgsFilterLineEdit::setShowClearButton( bool visible )
Expand Down Expand Up @@ -71,17 +72,8 @@ void QgsFilterLineEdit::updateClearIcon()
addAction( mClearAction, QLineEdit::TrailingPosition );
connect( mClearAction, &QAction::triggered, this, &QgsFilterLineEdit::clearValue );
}
else if ( !showClear && mClearAction )
{
// pretty freakin weird... seems the deleteLater call on the mClearAction
// isn't sufficient to actually remove the action from the line edit, and
// a kind of "ghost" action gets left behind... resulting in duplicate
// clear actions appearing if later we re-create the action.
// in summary: don't remove this "removeAction" call!
removeAction( mClearAction );
mClearAction->deleteLater();
mClearAction = nullptr;
}
if ( mClearAction )
mClearAction->setVisible( showClear );
}

void QgsFilterLineEdit::focusInEvent( QFocusEvent *e )
Expand Down

0 comments on commit 5c28693

Please sign in to comment.