External WM_DESTROY issue
-
Hi! My application has
Logwindow andTestwindow (main window), when I close the app I get the following error:External WM_DESTROY received for QWidgetWindow(0x2c9235f1890, name="LogWindow") , parent: QWindow(0x0) , transient parent: QWidgetWindow(0x2c920b375a0, name="TestClassWindow")Code:
Log *appLog; appLog = new Log(this); appLog->show();I delete
Logclass object in the destructor.Test::~Test() { delete appLog; }I can't use
setAttribute(Qt::WA_DeleteOnClose);function because it will delete the collected log, and it won't be available when openLogwindow again. How to fix this issue? Thanks in advance. -
Hi! My application has
Logwindow andTestwindow (main window), when I close the app I get the following error:External WM_DESTROY received for QWidgetWindow(0x2c9235f1890, name="LogWindow") , parent: QWindow(0x0) , transient parent: QWidgetWindow(0x2c920b375a0, name="TestClassWindow")Code:
Log *appLog; appLog = new Log(this); appLog->show();I delete
Logclass object in the destructor.Test::~Test() { delete appLog; }I can't use
setAttribute(Qt::WA_DeleteOnClose);function because it will delete the collected log, and it won't be available when openLogwindow again. How to fix this issue? Thanks in advance.Hi,
You create it with parent, which mean it gets deleted automatically with the parent. And your delete appLog then deletes it a second time.
-Michael.
-
Hi,
You create it with parent, which mean it gets deleted automatically with the parent. And your delete appLog then deletes it a second time.
-Michael.
The issue is still present even when removing
delete appLog;from destructor. -
Hi,
Did you check whether you have other cases of multiple deletion in your code ?
-
Yes. It was the only one. I think the problem is with
Qt 5.7.1. I can't switch to the latest because it doesn't supportWin XP.On
Qt 5.8orQt 5.9when deploying the app, it throws the following error:
I can't find where in the
Qtsource files it calls theGetUserPrefferrdUILanguagesfunction? -
If you want to run on XP, stay with the latest Qt 5.6 release.
-
Deployment also works on
Qt 5.7.1onWin XP. Anyway, the current issue is withExternal WM_DESTROYmessage. Windows can send this message in both cases:- I delete
Logobject twice Qtdoesn't delete it as parent
- I delete
-
I have fixed this issue by checking
Logobject fornullptrand emitting signal fromQCloseEventfunction and connect to the slotLog::deleteLater. So now it deletes when app closes.