-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Move file-static RenderWindow and RenderTexture instances inside functions to fix GL race condition on startup #677
base: master
Are you sure you want to change the base?
Conversation
I did not mean to add the vcxproj or sln files. Should I close and re-open a new PR without those changes? |
You can get the VS file changes out of it without closing this PR. From the command line of your local branch:
|
A couple of small amendments to NQN's suggestion. Before running any of that, run the following command: git show --stat HEAD That will give you a line starting with "commit HASH", where HASH looks like a random string. Copy-paste the hash. Then, instead of the commit command NQN suggested, use this commit one: git commit -C HASH Where HASH is the string you just copy-pasted. I think you can also add |
…tions to fix GL race condition on startup
463f657
to
9d99644
Compare
I think it worked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually pretty nice. It might be a huge change, but it's nice and simple – practically a find-and-replace for the most part. There are a couple of small issues, but once those are dealt with (and once I've worked out the CI problem in #674 / #675), I'll go ahead and merge it.
Thanks for the help!
sf::RenderTexture& toolbar_gworld() | ||
{ | ||
static sf::RenderTexture instance; | ||
return instance; | ||
} | ||
cToolbar toolbar; | ||
} | ||
sf::RenderTexture& cToolbar::cache() | ||
{ | ||
return UI::toolbar_gworld(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any need to have two different functions here. I'd recommend declaring cToolbar::cache()
static in the header, and moving the cntent of toolbar_gworld()
into it.
Also, I don't think it needs to be made public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it this way just to be consistent with the other instances of sf::RenderWorld/Texture but please make any desired changes!
@@ -4,7 +4,7 @@ | |||
#include "pc.menus.hpp" | |||
|
|||
OpenBoEPCEditMenu::OpenBoEPCEditMenu(sf::RenderWindow& window) | |||
: mainPtr { window } | |||
: mainPtr() { window } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. I'm pretty sure it won't even compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch! It looks like this class is only used in pc.menus.linux.cpp so I didn’t try compiling it on Win32.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CelticMinstrel I think the CI would have shown this error if you approve the workflow to run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a Linux setup right now so I can't check directly.
This change is not required on all platforms, but currently when compiling against SFML 2.6.2 static libraries, at runtime, the GL layer on Windows is encountering an Access Violation attempting to lock a critical section before main() is reached.