double free or corruption (out) when closing a QDialog with the WA_DeleteOnClose attribute set
-
@JonB said in double free or corruption (out) when closing a QDialog with the WA_DeleteOnClose attribute set:
A "typo" is a misspelling, not a complete reversal of a comment's intention! :D
I added the comma after the fact, which introduced the missing negation, so *shrug* happens.
@J-Hilk said in double free or corruption (out) when closing a QDialog with the WA_DeleteOnClose attribute set:
no matter what, telling a class to commit suicide is sinister in my books :P
Your books are wrong. We are a free-haven! ;)
-
@kshegunov said in double free or corruption (out) when closing a QDialog with the WA_DeleteOnClose attribute set:
I added the comma
-
-
@kshegunov said in double free or corruption (out) when closing a QDialog with the WA_DeleteOnClose attribute set:
You don't need to be a Qt developer to know this, and it has nothing to do with how you call the delete -- from the outside, from the inside (i.e. deleting this), through a custom event or without.
Agreed, but how do I know what the
Qt::WA_DeleteOnClose
actually does? One can guess it causes the call ofdelete
on the variable but that was just not enough to me to be sure (and obviously I was looking for an answer in the wrong place in the source code). Anyway, now I've got the answer. Thank you. -
@LRDPRDX said in double free or corruption (out) when closing a QDialog with the WA_DeleteOnClose attribute set:
Agreed, but how do I know what the Qt::WA_DeleteOnClose actually does?
If you feel the name doesn't give it up, or isn't clear enough, I'd've suggested looking up in the documentation:
https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enumIt's sort of the point of having documentation - so you don't need to go browsing through the code, and thankfully Qt has the best one I've ever seen.
-
In terminal, "double free or corruption (out)" message is printed after the destructor has been called.
Update: Sorry for bothering you. I was having similar issue. I saw your post in stackoverflow and then my problem solved when I allocated my QMainWindow object in heap instead of the stack.
Many thanks!