Details
-
Bug
-
Resolution: Duplicate
-
P1: Critical
-
None
-
6.6.2, 6.6.3, 6.7.0
-
None
Description
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40886#note_1854394876
reproduce steps:
1. create cppcrash.cpp:
cppcrash.cpp
#include <QApplication> #include <QWidget> #include <QMouseEvent> struct MyWidget3:QWidget{ using QWidget::QWidget;//inherit constructors void mousePressEvent(QMouseEvent *event){ this->hide(); this->deleteLater();//`delete this;` or `this->destroy();` also crash } }; struct MyWidget2:QWidget{ using QWidget::QWidget;//inherit constructors void mousePressEvent(QMouseEvent *event){ MyWidget3 *w3=new MyWidget3(nullptr,Qt::Window); w3->setAttribute(Qt::WA_DeleteOnClose);//delete this line if you want memory leak w3->setWindowTitle("click me (MyWidget3)"); w3->setWindowModality(Qt::ApplicationModal); w3->show(); } }; struct MyWidget1:QWidget{ using QWidget::QWidget;//inherit constructors void mousePressEvent(QMouseEvent *event){ MyWidget2 *w2=new MyWidget2(nullptr,Qt::Window); w2->setAttribute(Qt::WA_DeleteOnClose);//delete this line if you want memory leak w2->setWindowTitle("click me (MyWidget2)"); w2->setWindowModality(Qt::ApplicationModal); w2->show(); } }; int main(int argc,char **argv){ QApplication a(argc,argv); MyWidget1 w1(nullptr,Qt::Window); w1.setWindowTitle("click me (MyWidget1)"); w1.show(); a.exec(); }
2. run:
g++ \ cppcrash.cpp \ -o cppcrash \ -O0 \ -ggdb \ -I/usr/include/x86_64-linux-gnu/qt6 \ -I/usr/include/x86_64-linux-gnu/qt6/QtWidgets \ -I/usr/include/x86_64-linux-gnu/qt6/QtGui \ -I/usr/include/x86_64-linux-gnu/qt6/QtCore \ -lQt6Core \ -lQt6Gui \ -lQt6Widgets
3. run:
./cppcrash
4. click inside window named "click me (MyWidget1)"
5. click inside window named "click me (MyWidget2)"
6. click inside window named "click me (MyWidget3)"
Attachments
Issue Links
- duplicates
-
QTBUG-123032 [REG: 6.6.1->6.6.2] Override cursor changes together with window creation and destruction crashes on KDE
- Closed