mirror of https://github.com/PCSX2/pcsx2.git
Qt: Add comment on ODR violation workaround
This commit is contained in:
parent
ddf839beb0
commit
8975f2d92c
|
@ -1786,6 +1786,13 @@ static void RegisterTypes()
|
|||
{
|
||||
qRegisterMetaType<std::optional<bool>>();
|
||||
qRegisterMetaType<std::optional<WindowInfo>>("std::optional<WindowInfo>()");
|
||||
// Bit of fun with metatype names
|
||||
// On Windows, the real type name here is "std::function<void __cdecl(void)>"
|
||||
// Normally, the fact that we `Q_DECLARE_METATYPE(std::function<void()>);` in QtHost.h would make it also register under "std::function<void()>"
|
||||
// The metatype is a pointer to `QMetaTypeInterfaceWrapper<std::function<void()>>::metaType`, which contains a pointer to the function that would register the alternate name
|
||||
// But to anyone who can't see QtHost.h, that pointer should be null, opening us up to ODR violations
|
||||
// Turns out some of our automoc files also instantiate that metaType (with the null pointer), so if we try to rely on it, everything will break if we get unlucky with link order
|
||||
// Instead, manually register under the desired name:
|
||||
qRegisterMetaType<std::function<void()>>("std::function<void()>");
|
||||
qRegisterMetaType<std::shared_ptr<VMBootParameters>>();
|
||||
qRegisterMetaType<GSRendererType>();
|
||||
|
|
Loading…
Reference in New Issue