Skip to content
Permalink
Browse files

fix crash on MacOS

  • Loading branch information
PeterPetrik authored and github-actions committed Feb 17, 2021
1 parent 8f3eeb3 commit ae7ea7680b1681e4e435a9869b238d9d60914118
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 ae7ea76

Please sign in to comment.