[rkward] rkward/windows: Remove tool windows from bar, when they are destroyed.
Thomas Friedrichsmeier
null at kde.org
Wed Jan 29 16:25:26 GMT 2020
Git commit f92a60551fd067351ed16a7ed96e9aa5b0148f26 by Thomas Friedrichsmeier.
Committed on 29/01/2020 at 16:24.
Pushed by tfry into branch 'master'.
Remove tool windows from bar, when they are destroyed.
This will be important once we allow loading / unloading kate plugins.
With some luck it also fixes current (non-determinate) crash on exit issues.
M +9 -0 rkward/windows/rktoolwindowbar.cpp
M +1 -0 rkward/windows/rktoolwindowbar.h
https://commits.kde.org/rkward/f92a60551fd067351ed16a7ed96e9aa5b0148f26
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index f59cc021..e70e6348 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -154,6 +154,7 @@ void RKToolWindowBar::addWidget (RKMDIWindow *window) {
window->tool_window_bar = this;
widget_to_id.insert (window, id);
+ connect (window, &QObject::destroyed, this, &RKToolWindowBar::windowDestroyed);
connect (tab (id), &KMultiTabBarTab::clicked, this, &RKToolWindowBar::tabClicked);
tab (id)->installEventFilter (this);
@@ -173,6 +174,13 @@ void RKToolWindowBar::reclaimDetached (RKMDIWindow *window) {
container->layout ()->addWidget (window);
}
+void RKToolWindowBar::windowDestroyed(QObject* window) {
+ RK_TRACE (APP);
+
+ int id = widget_to_id.take (static_cast<RKMDIWindow *> (window));
+ removeTab (id);
+}
+
void RKToolWindowBar::removeWidget (RKMDIWindow *widget) {
RK_TRACE (APP);
RK_ASSERT (widget_to_id.contains (widget));
@@ -182,6 +190,7 @@ void RKToolWindowBar::removeWidget (RKMDIWindow *widget) {
removeTab (id);
widget_to_id.remove (widget);
+ disconnect (widget, &QObject::destroyed, this, &RKToolWindowBar::windowDestroyed);
widget->tool_window_bar = 0;
if (widget->isAttached ()) {
diff --git a/rkward/windows/rktoolwindowbar.h b/rkward/windows/rktoolwindowbar.h
index 213a59c4..0bf9b6cf 100644
--- a/rkward/windows/rktoolwindowbar.h
+++ b/rkward/windows/rktoolwindowbar.h
@@ -66,6 +66,7 @@ private:
friend class RKWorkplace;
void reclaimDetached (RKMDIWindow *window);
void closeOthers (RKMDIWindow *window);
+ void windowDestroyed (QObject *window);
int getSplitterSize () const;
void setSplitterSize (int new_size);
More information about the rkward-tracker
mailing list