SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.73k stars 1.12k forks source link

Crash on non-optimized build on windows #981

Open msc94 opened 6 years ago

msc94 commented 6 years ago

Hello,

since I haven't got the debug build on windows to run successfully, but wanted to fix some test I just tried disabling the Optimizations on libopenage for some smoother debugging experience.

I got a ACCESS_VIOLATION crash when I tried that on the function qmlRegisterTypes<>. I probably ran into the same problem these guys have: https://github.com/benlau/quickflux/issues/7 and did the same thing to fix the problem as they did. I bundled all the global static calls and wrapped them around Q_COREAPP_STARTUP_FUNCTION so they are called after QCoreApplication has been initialized.

You can see my progress there: https://github.com/schnema123/openage/commit/25bde24e278fbe6ee6588131f9a03fa7343c5afb

Could there be any problems on linux with this setup?

Greetings

TheJJ commented 6 years ago

Just by looking at it, I like the removal of all the Q_UNUSED statements. @ChipmunkV designed the GUI, so he should be more competent to decide about good design and potential problems here.

VelorumS commented 6 years ago

Yes, I always wondered why in the code examples there are type registrations in main().

I'd rather not bundle them. Bundling makes harder to find out "why my type doesn't work". It also mixes game-specific and non-game-specific types. If doing Q_COREAPP_STARTUP_FUNCTION separately for each of them works - then perfect.

Actually, there are a lot of questions and discussions around the problems with the self-registering types in C++, it's not a particularly exciting topic.