-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QFont intialized before QApplication causes segfault with static Qt #54
Comments
If you agree with the fix I can create a merge request |
@oliverdaniell thanks for report. |
local static |
The issue came up on gcc 5.4 so I don't think it's related to differences in the handling of static between c++98 and c++11 (I assume by c++11 magic statics you mean the thread safe initialization?). I'm not sure why the code works when linking dynamically against Qt. From the doc
Anyway EASY_GLOBALS looks like the logical place to put it so I will get that done tomorrow. |
Yes, I mean thread safe initialization. I just wanted to say that hiding
Nice 👍 |
Initialization of fonts before QApplication is not valid and causes a segfault when linking statically against Qt. This is caused by the initialization of non-local variables before main. eg.
const auto BG_FONT = ::profiler_gui::EFont("Helvetica", 10, QFont::Bold);
This can be fixed by replacing the above with
auto const & BG_FONT() { static const auto BG_FONT = ::profiler_gui::EFont("Helvetica", 10, QFont::Bold); return BG_FONT; }
The text was updated successfully, but these errors were encountered: