Using Qt 4.8 with C ++. I work with application plugins that load and unload at runtime. The same plugin can be downloaded several times during the life of the application. One of these plugins uses Q_DECLARE_METATYPE for some types that need to be stored in QVariant . When the plugin is reloaded later, the old declaration still points to the original memory space of the now unloaded library. This leads to access violations when Qt tries to create a QVariant from a QVariant meta type. We have already considered a similar problem with qRegisterMetaType() : we register meta types when loading a library and unregister these types immediately before unloading the library. Unfortunately, this does not seem to be a choice, but not a registration of meta types.
How can we effectively handle cases where a library declaring a meta type is loaded and unloaded several times?
source share