Solved Run-time error : QMetaType::registerType: Binary compatibility break -- Size mismatch for type ...
-
I have a run-time crash due to a qRegisterMetaType();
- 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)
- 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.
-
@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.
-
@kshegunov , you are a legend. Thanks.