Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Closing a qmainwindow application on Windows
Forum Updated to NodeBB v4.3 + New Features

Closing a qmainwindow application on Windows

Scheduled Pinned Locked Moved General and Desktop
9 Posts 6 Posters 2.5k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fahmouch
    wrote on last edited by
    #1

    Hi All,

    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.

    K 1 Reply Last reply
    0
    • F fahmouch

      Hi All,

      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.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @fahmouch
      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.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fahmouch
        wrote on last edited by
        #3

        Yes, i'm closing the client socket using the close function.

        There is any other method to delete them properly?

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Why do you think this is related to your network programming? Could be anything.

          F 1 Reply Last reply
          0
          • M Offline
            M Offline
            mcosta
            wrote on last edited by
            #5

            Hi,

            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??

            Once your problem is solved don't forget to:

            • Mark the thread as SOLVED using the Topic Tool menu
            • Vote up the answer(s) that helped you to solve the issue

            You can embed images using (http://imgur.com/) or (http://postimage.org/)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              alex_malyu
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • ? A Former User

                Why do you think this is related to your network programming? Could be anything.

                F Offline
                F Offline
                fahmouch
                wrote on last edited by
                #7

                @Wieland

                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?

                1 Reply Last reply
                0
                • sneubertS Offline
                  sneubertS Offline
                  sneubert
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mcosta
                    wrote on last edited by
                    #9

                    @fahmouch Without code and/or crash dump is very hard for us to help you

                    Once your problem is solved don't forget to:

                    • Mark the thread as SOLVED using the Topic Tool menu
                    • Vote up the answer(s) that helped you to solve the issue

                    You can embed images using (http://imgur.com/) or (http://postimage.org/)

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved