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. Run-time error : QMetaType::registerType: Binary compatibility break -- Size mismatch for type ...
Qt 6.11 is out! See what's new in the release blog

Run-time error : QMetaType::registerType: Binary compatibility break -- Size mismatch for type ...

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 898 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.
  • D Offline
    D Offline
    ddze
    wrote on last edited by
    #1

    I have a run-time crash due to a qRegisterMetaType();

    1. So a class to be registered is declared with the Q_DECLARE_METATYPE.
    class IBase {
    public:
        IBase();                      /** default constructor*/
        IBase(const IBase & a);       /** copy constructor */
        ~IBase(){}                    /** destructor */
    };
    Q_DECLARE_METATYPE(IBase)
    
    1. the constructor of the class that uses the IBase calls the qRegisterMetaType() and than crashes.
    IBaseMimeData::IBaseMimeData(const IBase *mod){
        refModule = mod;
        qRegisterMetaType<IBase*>("IBase");   // <<  RUN-TIME CRASH
        supportedFormats <<DRAG_AND_DROP_MIME_NAME;
    }
    
    

    How to fix this problem.? I do not have any other Qt libraries but the Version 5.50 / and the compiler Mingw 492.

    kshegunovK 1 Reply Last reply
    0
    • D ddze

      I have a run-time crash due to a qRegisterMetaType();

      1. So a class to be registered is declared with the Q_DECLARE_METATYPE.
      class IBase {
      public:
          IBase();                      /** default constructor*/
          IBase(const IBase & a);       /** copy constructor */
          ~IBase(){}                    /** destructor */
      };
      Q_DECLARE_METATYPE(IBase)
      
      1. the constructor of the class that uses the IBase calls the qRegisterMetaType() and than crashes.
      IBaseMimeData::IBaseMimeData(const IBase *mod){
          refModule = mod;
          qRegisterMetaType<IBase*>("IBase");   // <<  RUN-TIME CRASH
          supportedFormats <<DRAG_AND_DROP_MIME_NAME;
      }
      
      

      How to fix this problem.? I do not have any other Qt libraries but the Version 5.50 / and the compiler Mingw 492.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @ddze
      Hello,
      You're doing it wrong.

      IBaseMimeData::IBaseMimeData(const IBase * mod)
      {
          // ...
          qRegisterMetaType<IBase>();   //< IBase is declared, not IBase *. Don't pass a string argument to the function!
          // ...
      }
      

      Kind regards.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • D Offline
        D Offline
        ddze
        wrote on last edited by ddze
        #3

        @kshegunov , you are a legend. 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