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. "takes ownership of widget" - What is really happenning?
Forum Updated to NodeBB v4.3 + New Features

"takes ownership of widget" - What is really happenning?

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 3 Posters 1.1k Views 1 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.
  • Christian EhrlicherC Christian Ehrlicher

    The parent of QToolButton is first the MainWindow instance, after your call it's the QToolBar. An QObject can not have more than one parent so a double delete is not possible due to QObject's automatic destruction of the children.

    H Offline
    H Offline
    hbatalha
    wrote on last edited by
    #3

    @Christian-Ehrlicher So does it mean that the code above won't cause a crash?

    C 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Why should it? Is my explanation and the Qt documentation about QObject parent - child relationship that bad?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      H 1 Reply Last reply
      1
      • H hbatalha

        @Christian-Ehrlicher So does it mean that the code above won't cause a crash?

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by ChrisW67
        #5

        @hbatalha Yes, the code will not cause a crash.

        A QObject has a singular parent object and potentially many children.

        When you call myQObject->setParent() it will check for an existing parent, find myQObject in the parent's children list and remove it, then set myQObject's parent pointer and add myQObject to the new parent's child list (There are other checks and things happening). myQObject only appears in at most one QObject's child list at a time. It will be deleted when that parent QObject is deleted.

        1 Reply Last reply
        3
        • Christian EhrlicherC Christian Ehrlicher

          Why should it? Is my explanation and the Qt documentation about QObject parent - child relationship that bad?

          H Offline
          H Offline
          hbatalha
          wrote on last edited by
          #6

          @Christian-Ehrlicher no, not at all. that was just my disappointment since I haven't yet found the cause for my app to freeze when closing it.

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #7

            Did you already tried to see something with the debugger?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            H 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              Did you already tried to see something with the debugger?

              H Offline
              H Offline
              hbatalha
              wrote on last edited by
              #8

              @Christian-Ehrlicher yeah but my app freezes randomly so it is very difficult.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #9

                When it freezes attach the debugger and see what's going on.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                H 1 Reply Last reply
                1
                • Christian EhrlicherC Christian Ehrlicher

                  When it freezes attach the debugger and see what's going on.

                  H Offline
                  H Offline
                  hbatalha
                  wrote on last edited by
                  #10

                  @Christian-Ehrlicher the problem is I will not know when it will freeze.

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    But when you see it - what's the problem attaching a debugger then?

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    H 2 Replies Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      But when you see it - what's the problem attaching a debugger then?

                      H Offline
                      H Offline
                      hbatalha
                      wrote on last edited by
                      #12

                      @Christian-Ehrlicher as stated in the OP:

                      PS: my debugger is not working properly(not getting the stack trace)

                      But I got it working yesterday and since then my app haven't frozen when closing it after numerous tries yet. I will keep trying and when/if it does crash I will get back to you here.

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Christian Ehrlicher

                        But when you see it - what's the problem attaching a debugger then?

                        H Offline
                        H Offline
                        hbatalha
                        wrote on last edited by
                        #13

                        @Christian-Ehrlicher It just crashed when attached to debugger and I got this in the app output:

                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(1) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(2) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(3) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(4) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(5) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(6) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(7) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(8) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(9) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(10) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(11) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(12) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(13) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(14) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(15) tid(35258) 800706BA The RPC server is unavailable.
                        onecore\com\combase\dcomrem\call.cxx(4907)\combase.dll!00007FFD40813B4B: (caller: 00007FFD40814961) ReturnHr(16) tid(35258) 800706BA The RPC server is unavailable.
                        

                        I am g searching it, have no idea what they mean.

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          ChrisW67
                          wrote on last edited by
                          #14

                          Is that "onecore" reference anything to do with Xero?

                          H 1 Reply Last reply
                          0
                          • C ChrisW67

                            Is that "onecore" reference anything to do with Xero?

                            H Offline
                            H Offline
                            hbatalha
                            wrote on last edited by
                            #15

                            @ChrisW67 I don't know. What is xero(in this context)?

                            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