From b955a9fc005682ccde57aad3de68405e944f4cf7 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Fri, 11 Dec 2020 12:44:32 -0800 Subject: [PATCH] Destroy the error erroroverlay with base widget Fix #19 --- src/erroroverlay.cpp | 3 ++- src/erroroverlay.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/erroroverlay.cpp b/src/erroroverlay.cpp index efef8f5..0f85fbd 100644 --- a/src/erroroverlay.cpp +++ b/src/erroroverlay.cpp @@ -60,7 +60,8 @@ ErrorOverlay::ErrorOverlay(QWidget *baseWidget, QWidget *parent) : setAutoFillBackground(true); m_BaseWidget->installEventFilter(this); - + // Destory overlay with the base widget. + connect(m_BaseWidget, SIGNAL(destroyed()), this, SLOT(deleteLater())); connect(Fcitx::Global::instance(), SIGNAL(connectStatusChanged(bool)), this, SLOT(onConnectStatusChanged(bool))); onConnectStatusChanged(Fcitx::Global::instance()->inputMethodProxy() != 0); } diff --git a/src/erroroverlay.h b/src/erroroverlay.h index cf8aeaf..847b456 100644 --- a/src/erroroverlay.h +++ b/src/erroroverlay.h @@ -21,6 +21,7 @@ #define ERROROVERLAY_H #include +#include class ErrorOverlay : public QWidget { @@ -38,7 +39,7 @@ public slots: void reposition(); private: - QWidget *m_BaseWidget; + QPointer m_BaseWidget; bool m_enable; };