Closed scurest closed 3 months ago
Thank you for noticing that issue and pointing to the documentation, your suggested code looks fine, can you submit a PR?
There's code in openAboutDialog with the same problem
I don't really understand why this code isn't guarded by QCoreApplication::instance == nullptr
the same as the config code? Also how would I open the About dialog in RMG to test it?
in mupen64plus, that function isn't used, only in Project64
Look at this code in GLideNUI.cpp
https://github.com/gonetz/GLideN64/blob/3b43a13a80dfc2eb6357673440b335e54eaa3896/src/GLideNUI/GLideNUI.cpp#L34-L42
Consulting the documentation for
QApplication::QApplication(int &argc, char **argv)
, we can readThis code violates all three conditions.
I don't know anything about Qt, but if that if-block is supposed to run only once, then a simple fix would be just to use statics
Context
I'm fairly sure this is the cause of certain non-deterministic crashes I get when opening the Config Dialog while working on a branch. The code gets to
w.show()
, which eventually callsQCoreApplication::arguments()
, which crashes in strlen... usually. The above patch appears to fix it.Unfortunately I wasn't able to repro with master, and I wasn't able to get far enough with -fsanitize=address to reach that line, so I don't have a reproduction for you, but hopefully the doc violation will be enough to convince you it's worth changing.