From 5b48b7763acb4323ab7bbdc09553a2dfe720f5ed Mon Sep 17 00:00:00 2001 From: gambas Date: Sat, 14 Nov 2020 16:20:20 +0100 Subject: [PATCH] Deleting a window now raises the Close event immediately, like in Qt components. [GB.GTK] * BUG: Deleting a window now raises the Close event immediately, like in Qt components. [GB.GTK3] * BUG: Deleting a window now raises the Close event immediately, like in Qt components. --- gb.gtk/src/gcontrol.h | 2 +- gb.gtk/src/gmainwindow.cpp | 8 +++++++- gb.gtk/src/gmainwindow.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gb.gtk/src/gcontrol.h b/gb.gtk/src/gcontrol.h index ce7b31497..0cd86c2e7 100644 --- a/gb.gtk/src/gcontrol.h +++ b/gb.gtk/src/gcontrol.h @@ -206,7 +206,7 @@ public: bool grab(); - void destroy(); + virtual void destroy(); void destroyNow() { destroy(); cleanRemovedControls(); } void lock() { _locked++; } diff --git a/gb.gtk/src/gmainwindow.cpp b/gb.gtk/src/gmainwindow.cpp index a638066fb..e06d20585 100644 --- a/gb.gtk/src/gmainwindow.cpp +++ b/gb.gtk/src/gmainwindow.cpp @@ -504,7 +504,7 @@ gMainWindow::gMainWindow(gContainer *par) : gContainer(par) gMainWindow::~gMainWindow() { - //fprintf(stderr, "delete window %p %s\n", this, name()); + //fprintf(stderr, "delete window %p %s _opened = %d\n", this, name(), _opened); gApplication::handleFocusNow(); @@ -1971,3 +1971,9 @@ void gMainWindow::calcCsdSize() fprintf(stderr, "calcCsdSize: %s: csd = %d %d\n", name(), _csd_w, _csd_h); #endif } + +void gMainWindow::destroy() +{ + doClose(); + gControl::destroy(); +} diff --git a/gb.gtk/src/gmainwindow.h b/gb.gtk/src/gmainwindow.h index 666f246f0..5a4a8a3a5 100644 --- a/gb.gtk/src/gmainwindow.h +++ b/gb.gtk/src/gmainwindow.h @@ -115,6 +115,7 @@ public: virtual bool resize(int w, int h); bool close(); virtual void reparent(gContainer *newpr, int x, int y); + virtual void destroy(); //"Signals" void (*onOpen)(gMainWindow *sender);