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. External WM_DESTROY issue
QtWS25 Last Chance

External WM_DESTROY issue

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 5.2k Views
  • 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.
  • Cobra91151C Offline
    Cobra91151C Offline
    Cobra91151
    wrote on last edited by Cobra91151
    #1

    Hi! My application has Log window and Test window (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 Log class 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 open Log window again. How to fix this issue? Thanks in advance.

    m.sueM 1 Reply Last reply
    0
    • Cobra91151C Cobra91151

      Hi! My application has Log window and Test window (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 Log class 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 open Log window again. How to fix this issue? Thanks in advance.

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      @Cobra91151

      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.

      Cobra91151C 1 Reply Last reply
      1
      • m.sueM m.sue

        @Cobra91151

        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.

        Cobra91151C Offline
        Cobra91151C Offline
        Cobra91151
        wrote on last edited by Cobra91151
        #3

        @m.sue

        The issue is still present even when removing delete appLog; from destructor.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Did you check whether you have other cases of multiple deletion in your code ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Cobra91151C 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Did you check whether you have other cases of multiple deletion in your code ?

            Cobra91151C Offline
            Cobra91151C Offline
            Cobra91151
            wrote on last edited by
            #5

            @SGaist

            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 support Win XP.

            On Qt 5.8 or Qt 5.9 when deploying the app, it throws the following error:

            0_1498158164381_error.jpg

            I can't find where in the Qt source files it calls the GetUserPrefferrdUILanguages function?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              If you want to run on XP, stay with the latest Qt 5.6 release.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              Cobra91151C 2 Replies Last reply
              0
              • SGaistS SGaist

                If you want to run on XP, stay with the latest Qt 5.6 release.

                Cobra91151C Offline
                Cobra91151C Offline
                Cobra91151
                wrote on last edited by
                #7

                @SGaist

                Deployment also works on Qt 5.7.1 on Win XP. Anyway, the current issue is with External WM_DESTROY message. Windows can send this message in both cases:

                • I delete Log object twice
                • Qt doesn't delete it as parent
                1 Reply Last reply
                0
                • SGaistS SGaist

                  If you want to run on XP, stay with the latest Qt 5.6 release.

                  Cobra91151C Offline
                  Cobra91151C Offline
                  Cobra91151
                  wrote on last edited by
                  #8

                  @SGaist

                  I have fixed this issue by checking Log object for nullptr and emitting signal from QCloseEvent function and connect to the slot Log::deleteLater. So now it deletes when app closes.

                  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