Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Closing a qmainwindow application on Windows
I am developing a network qt application (client-server application). In fact, I 'm using QTcpSocket to communicate between the clients and the server.
The application works well, but when i try to close the client interface on Windows, I have a runtime problem. Exactly, I have this problem: his application has requested the runtime to terminate it in an unusual way.
I tried to re-implement the closeEvent function by closing the client socket on closing the main window, but i still have the same problem.
How can i fix this bug?
Any help would be appreciated.
koahnig last edited by
Did you close all communication through QTcpSocket and delete them properly?
It depends how you set out the sockets. It might be that they are still receiving information while you close the application.
Yes, i'm closing the client socket using the close function.
There is any other method to delete them properly?
A Former User last edited by
Why do you think this is related to your network programming? Could be anything.
mcosta last edited by
as @Wieland said, probably the problem in not related to TCP Socket.
Can you post the code of your Window? Have you tried to debug??
alex_malyu last edited by
90% of such problems occur when people provide parent to the QObject (usually QWidget ) derived classes allocated on the heap.
As result their objects are deleted twice which causes termination.
I tried to execute my application without communication between the client and the server. And by doing that, i haven't any problem on closing the application.
I think that the cause of this problem that the runtime still receives responses to the clients, that's why, it couldn't close properly this application.
Have you any idea how to fix this problem?
sneubert last edited by
Did you check for missed exceptions? Maybe some of your network code throws something if your application is closing. A unhandled exceptions can causes the error you described in your first post.
mcosta last edited by
@fahmouch Without code and/or crash dump is very hard for us to help you