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. Called object is not of the correct type (class destructor may have already run) - what is it? o.o

Called object is not of the correct type (class destructor may have already run) - what is it? o.o

Scheduled Pinned Locked Moved Unsolved General and Desktop
qcombobox
20 Posts 11 Posters 3.8k 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.
  • D Dariusz
    24 Jun 2022, 17:16

    Hey

    Yeah thats a crazy one overload, looking at data years old so uhh my bad!

    Fixing it sadly did not help, another signal/slots screams here >

    This crash > connect(addItem, &QAction::triggered, this, &icCGraphicsScene::addItemPoint);
    This works > connect(addItem, &QAction::triggered, this, [this]() { this->addItemPoint(); });
    Yes I know the "works" one is not good, but I simply cant connect normal signals on M1 mac. Maybe its ARM issue ?

    J Offline
    J Offline
    JonB
    wrote on 24 Jun 2022, 17:36 last edited by
    #8

    @Dariusz
    If somebody can help further they will surely want to know what version of Qt you are using and what kind of MacOS version?

    D 1 Reply Last reply 24 Jun 2022, 17:59
    0
    • J JonB
      24 Jun 2022, 17:36

      @Dariusz
      If somebody can help further they will surely want to know what version of Qt you are using and what kind of MacOS version?

      D Offline
      D Offline
      Dariusz
      wrote on 24 Jun 2022, 17:59 last edited by
      #9

      @JonB 6.3.0, MacOS Monterey 12.4 (21F79). Mac M1 Mini.
      I've had this problem for year + now I think.

      Cant signal slot 50% of my connections for some reason.

      Just did not know that this error is this. I usually fix it via either old SIGNAL(), SLOT() connection or lambda :/

      J 1 Reply Last reply 24 Jun 2022, 18:01
      0
      • D Dariusz
        24 Jun 2022, 17:59

        @JonB 6.3.0, MacOS Monterey 12.4 (21F79). Mac M1 Mini.
        I've had this problem for year + now I think.

        Cant signal slot 50% of my connections for some reason.

        Just did not know that this error is this. I usually fix it via either old SIGNAL(), SLOT() connection or lambda :/

        J Offline
        J Offline
        JonB
        wrote on 24 Jun 2022, 18:01 last edited by
        #10

        @Dariusz
        ...and then someone will ask whether you can produce any one minimal example which shows this problem for you, so they can actually try it...? :)

        D 1 Reply Last reply 24 Jun 2022, 18:09
        0
        • J JonB
          24 Jun 2022, 18:01

          @Dariusz
          ...and then someone will ask whether you can produce any one minimal example which shows this problem for you, so they can actually try it...? :)

          D Offline
          D Offline
          Dariusz
          wrote on 24 Jun 2022, 18:09 last edited by
          #11

          @JonB Its been on my todo list for a year :- )

          I will eventually make it...

          I'm sorry, its topic repeat, I know the answer is null till I post a git project that can reproduce it, its just lots of work to do it :D
          I just didn't realise it was signal error again, sigh.
          Sorri, & thank you for help <3
          Regards
          Dariusz

          1 Reply Last reply
          0
          • D Dariusz
            24 Jun 2022, 17:16

            Hey

            Yeah thats a crazy one overload, looking at data years old so uhh my bad!

            Fixing it sadly did not help, another signal/slots screams here >

            This crash > connect(addItem, &QAction::triggered, this, &icCGraphicsScene::addItemPoint);
            This works > connect(addItem, &QAction::triggered, this, [this]() { this->addItemPoint(); });
            Yes I know the "works" one is not good, but I simply cant connect normal signals on M1 mac. Maybe its ARM issue ?

            K Offline
            K Offline
            KroMignon
            wrote on 26 Jun 2022, 14:06 last edited by
            #12

            @Dariusz said in Called object is not of the correct type (class destructor may have already run) - what is it? o.o:

            Hey
            Yeah thats a crazy one overload, looking at data years old so uhh my bad!
            Fixing it sadly did not help, another signal/slots screams here >
            This crash > connect(addItem, &QAction::triggered, this, &icCGraphicsScene::addItemPoint);
            This works > connect(addItem, &QAction::triggered, this, this { this->addItemPoint(); });
            Yes I know the "works" one is not good, but I simply cant connect normal signals on M1 mac. Maybe its ARM issue ?

            DISCLAIMER: I have never developed Qt application for Mac (or used a Mac).

            My guess is that you have an issue on instance class life cycle.
            When creating a lambda function, the captured variables are copied.

            But this is just a fealling...

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            D 1 Reply Last reply 24 Apr 2023, 21:33
            0
            • K KroMignon
              26 Jun 2022, 14:06

              @Dariusz said in Called object is not of the correct type (class destructor may have already run) - what is it? o.o:

              Hey
              Yeah thats a crazy one overload, looking at data years old so uhh my bad!
              Fixing it sadly did not help, another signal/slots screams here >
              This crash > connect(addItem, &QAction::triggered, this, &icCGraphicsScene::addItemPoint);
              This works > connect(addItem, &QAction::triggered, this, this { this->addItemPoint(); });
              Yes I know the "works" one is not good, but I simply cant connect normal signals on M1 mac. Maybe its ARM issue ?

              DISCLAIMER: I have never developed Qt application for Mac (or used a Mac).

              My guess is that you have an issue on instance class life cycle.
              When creating a lambda function, the captured variables are copied.

              But this is just a fealling...

              D Offline
              D Offline
              Dariusz
              wrote on 24 Apr 2023, 21:33 last edited by Dariusz
              #13

              @KroMignon I'm back to this hell of an issue :- D

              Nope live-time is not the problem. Both objects are alive.

              Seems like he can't resolve signals/names somehow properly.
              Perhaps its my namespace.
              Or ARM
              Or there is some build flag I'm missing.

              I just did big update to my UI library, everything works on Windows, but I go to MAC and he ignores all signal/slots connections, or most of them. I'm linking against static .a library creating dylib one and loading it in my app at runtime.

              At some point Qt for mac fails in my crazy build :/

              I have to redo all my signals now from signal>signal or signal>slot connections to signal>lambda ;/////

              qOverload sadly does not work either.

              QLineEdit will just crash (or my customLineEdit) and QCheckBox will just "not work".

              im on 6.5 Qt btw. moved from 6.1 I think.

              M 1 Reply Last reply 24 Jul 2023, 07:05
              0
              • D Dariusz
                24 Apr 2023, 21:33

                @KroMignon I'm back to this hell of an issue :- D

                Nope live-time is not the problem. Both objects are alive.

                Seems like he can't resolve signals/names somehow properly.
                Perhaps its my namespace.
                Or ARM
                Or there is some build flag I'm missing.

                I just did big update to my UI library, everything works on Windows, but I go to MAC and he ignores all signal/slots connections, or most of them. I'm linking against static .a library creating dylib one and loading it in my app at runtime.

                At some point Qt for mac fails in my crazy build :/

                I have to redo all my signals now from signal>signal or signal>slot connections to signal>lambda ;/////

                qOverload sadly does not work either.

                QLineEdit will just crash (or my customLineEdit) and QCheckBox will just "not work".

                im on 6.5 Qt btw. moved from 6.1 I think.

                M Offline
                M Offline
                Marcus Tillmanns
                wrote on 24 Jul 2023, 07:05 last edited by
                #14

                @Dariusz
                I'm having the same issue (also M1 mac, haven't tried on other platforms yet). The problem seems to be that inside Qt code, the call to call dynamic_cast<>() fails for my object, even though it should work. The target class that it cannot dynamic_cast to is defined in a static library. When I change it to a dynamic library instead, everything works fine.

                Did you have any more luck in the mean time?

                J.HilkJ SGaistS 2 Replies Last reply 24 Jul 2023, 07:19
                1
                • M Marcus Tillmanns
                  24 Jul 2023, 07:05

                  @Dariusz
                  I'm having the same issue (also M1 mac, haven't tried on other platforms yet). The problem seems to be that inside Qt code, the call to call dynamic_cast<>() fails for my object, even though it should work. The target class that it cannot dynamic_cast to is defined in a static library. When I change it to a dynamic library instead, everything works fine.

                  Did you have any more luck in the mean time?

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on 24 Jul 2023, 07:19 last edited by
                  #15

                  @Marcus-Tillmanns interesting, I'm personally using a mix of static and dynamic libs (all qt based) on Mac and everything works just fine.

                  But I'm also using 5.15 and not Qt6


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  V 1 Reply Last reply 26 Mar 2024, 11:37
                  0
                  • M Marcus Tillmanns
                    24 Jul 2023, 07:05

                    @Dariusz
                    I'm having the same issue (also M1 mac, haven't tried on other platforms yet). The problem seems to be that inside Qt code, the call to call dynamic_cast<>() fails for my object, even though it should work. The target class that it cannot dynamic_cast to is defined in a static library. When I change it to a dynamic library instead, everything works fine.

                    Did you have any more luck in the mean time?

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 24 Jul 2023, 20:13 last edited by
                    #16

                    @Marcus-Tillmanns hi,

                    Any chances you are using plugins in your application ?

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

                    1 Reply Last reply
                    0
                    • danttiD Offline
                      danttiD Offline
                      dantti
                      wrote on 14 Sept 2023, 23:18 last edited by
                      #17

                      This is not related to ARM/Mac whatever, nor will happen before Qt 6.3.

                      The issue is that in 6.3 there's now an assert that checks if the receiver object and method "match", it works with lambdas as it's either incomplete or impossible to check because lambdas aren't part of the receiver type.

                      This happened to a code I replaced the old syntax and the issue was that some Parent class while destroying children of of them, had a signal being emitted on destructor, that called some functions and emitted back to the half destructed Parent hitting the assert.

                      What I did was to queue one the signals to allow the destructor to finish.

                      1 Reply Last reply
                      0
                      • J.HilkJ J.Hilk
                        24 Jul 2023, 07:19

                        @Marcus-Tillmanns interesting, I'm personally using a mix of static and dynamic libs (all qt based) on Mac and everything works just fine.

                        But I'm also using 5.15 and not Qt6

                        V Offline
                        V Offline
                        Vinny_Jones91
                        wrote on 26 Mar 2024, 11:37 last edited by Vinny_Jones91
                        #18

                        @SGAIST hello.

                        I've encountered the same issue with Qt6.6.2 and yes, we're using plugins in our macOS application.

                        Looks like dymanic_cast fails to work correctly across dylib boundaries.
                        -flat_namespace compile option helps with dynamic_cast itself (and so, fixed the mentioned assert), but causes other issues for us.

                        If you could share any thoughts on how this may be fixed, that would be much appreciated.

                        SGaistS 1 Reply Last reply 26 Mar 2024, 20:07
                        0
                        • V Vinny_Jones91
                          26 Mar 2024, 11:37

                          @SGAIST hello.

                          I've encountered the same issue with Qt6.6.2 and yes, we're using plugins in our macOS application.

                          Looks like dymanic_cast fails to work correctly across dylib boundaries.
                          -flat_namespace compile option helps with dynamic_cast itself (and so, fixed the mentioned assert), but causes other issues for us.

                          If you could share any thoughts on how this may be fixed, that would be much appreciated.

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 26 Mar 2024, 20:07 last edited by
                          #19

                          @Vinny_Jones91 hi and welcome to devnet,

                          Any chances you are using static libraries to build your plugins ?

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

                          1 Reply Last reply
                          0
                          • I Offline
                            I Offline
                            Icaro
                            wrote on 13 Sept 2024, 09:12 last edited by Icaro
                            #20

                            I had a similar issue and @SGaist question actually helped me.
                            My code was hitting the "called object is not the correct type class destructor..." assertion and I changed the library from static to dynamic and now it seems to work properly on MacOS.
                            Not sure what the issue is or if it is a bug that is already solved in more recent versions (I am currently using Qt6.4.2) but I will go for the dynamic library solution for now so I can move forward.
                            Thanks!

                            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