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

  • 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 {
        IBase();                      /** default constructor*/
        IBase(const IBase & a);       /** copy constructor */
        ~IBase(){}                    /** destructor */
    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.

  • Qt Champions 2017

    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.

  • @kshegunov , you are a legend. Thanks.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.