MainWindow deleteLater() segmentation fault
Solved
General and Desktop
-
If this is RTFM, point me )
Create simple GUI App in Creator, append button and write in slot: deleteLater()
Run it, press this button - segmentation fault take place
In application output "double free or curruption" error shown
Ubuntu 16.04 64Bit, Qt 5.12.0 from offline installer -
Please show use you code.
-
This post is deleted!
-
void MainWindow::on_pushButton_clicked() { deleteLater(); }
-
@abarmotov Why do you do this?
-
@abarmotov It is unusual that an object destroys itself. Can you explain why you're doing this?
The problem is (I guess your code looks like this):void main() { ... MainWindow window; ... app.exec(); // Here window will be destroyed, but you call deleteLater() in in the slot -> double delete }
-
So how does your main.cpp looks like? The same as jsulm posted? Then you must not call deleteLater() since you created MainWindow on the stack.