Skip to content
Permalink
Browse files

fix crash on MacOS

  • Loading branch information
PeterPetrik authored and nyalldawson committed Feb 18, 2021
1 parent edb7b52 commit 6768520967f6871b1cda045cd203659f61a5bb2c
Showing with 6 additions and 3 deletions.
  1. +4 −2 src/gui/qgsfocuskeeper.cpp
  2. +2 −1 src/gui/qgsfocuskeeper.h
@@ -21,12 +21,14 @@

QgsFocusKeeper::QgsFocusKeeper(): mWidgetToKeepFocused( QApplication::focusWidget() )
{
mWidgetToKeepFocused->installEventFilter( this );
if ( mWidgetToKeepFocused )
mWidgetToKeepFocused->installEventFilter( this );
}

QgsFocusKeeper::~QgsFocusKeeper()
{
mWidgetToKeepFocused->removeEventFilter( this );
if ( mWidgetToKeepFocused )
mWidgetToKeepFocused->removeEventFilter( this );
}

bool QgsFocusKeeper::eventFilter( QObject *obj, QEvent *event )
@@ -21,6 +21,7 @@
#define SIP_NO_FILE

#include <QObject>
#include <QPointer>

class QWidget;

@@ -35,7 +36,7 @@ class GUI_EXPORT QgsFocusKeeper : public QObject
{
Q_OBJECT

QWidget *mWidgetToKeepFocused = nullptr;
QPointer<QWidget> mWidgetToKeepFocused;

public:
QgsFocusKeeper();

0 comments on commit 6768520

Please sign in to comment.