summaryrefslogtreecommitdiff
path: root/source/kde/kcm-fcitx/destroy-erroroverlay-with-base-widget.patch
blob: dfb7c4513d5a418cdeb51ed3217b3daf60a85a04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From b955a9fc005682ccde57aad3de68405e944f4cf7 Mon Sep 17 00:00:00 2001
From: Weng Xuetian <wengxt@gmail.com>
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 <QWidget>
+#include <QPointer>
 
 class ErrorOverlay : public QWidget
 {
@@ -38,7 +39,7 @@ public slots:
     void reposition();
 
 private:
-    QWidget *m_BaseWidget;
+    QPointer<QWidget> m_BaseWidget;
     bool m_enable;
 };