Crash in closeEvent()
-
If I choose to ignore event in closeEvent() in QMainWindow, application crashes within a few seconds after clicking [x]
main.cpp:
#include "main_window.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }main_window.h:
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QCloseEvent> class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); protected slots: void closeEvent(QCloseEvent*); }; #endif // MAINWINDOW_Hmain_window.cpp
#include "main_window.h" void MainWindow::closeEvent(QCloseEvent *event) { event->ignore(); } MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { }Call stack:
1 poll 0x7ffff638699f
2 ?? 0x7ffff5fd28ce
3 g_main_context_iteration 0x7ffff5fd29ef
4 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 393 0x7ffff6c59b3a
5 QEventLoop::exec qflags.h 108 0x7ffff69bdd5b
6 QCoreApplication::exec qflags.h 74 0x7ffff69ba13e
7 main main.cpp 10 0x55555555724fFeels like the crash doesn't have anything to do with Qt (broken glibc?)
-
I updated glibc along with a few x11 libraries and after rebooting the problem is gone, although not sure if simple rebooting wouldn't do the trick (was up for a couple of months)