Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.15
-
None
Description
QFileDialog cause memory leak when invoke QFileDialog::open
Run the demo below, after a few times,QFileDialog dont work anymore
#include <QApplication> #include <QFileDialog> #include <QTimer> void Test() { QWidget* w = new QWidget(); w->show(); QFileDialog* dialog = new QFileDialog(w); dialog->open(nullptr, nullptr); QTimer::singleShot(1000, w, [=]() { dialog->close(); dialog->deleteLater(); w->close(); w->deleteLater(); }); } int main(int argc, char* argv[]) { SetCurrentProcessExplicitAppUserModelID(L"yes"); QApplication a(argc, argv); a.setQuitOnLastWindowClosed(false); QTimer* loop_timer = new QTimer(); loop_timer->setInterval(2000); loop_timer->setSingleShot(false); loop_timer->start(); QObject::connect(loop_timer, &QTimer::timeout, loop_timer, [=]() { Test(); }); return a.exec(); }