It was hard for me to fix a bug in a way such as this, but I tried to document it the best I can as seen in the documentation
here. Note that a context switch and checkMaximumTextureSize() is only ever called
once. It isn't called every single time someone needs to know the maximum texture size, the value is cached until the application exits.
If you don't like surprises (I know I don't), just call sf::Texture::getMaximumSize() once at the beginning of your application (you can even call it before creating the window if you want), and no more unexpected context switches will happen, i.e. it will behave just like it did before this workaround was implemented.
Regardless, to save others the trouble in the future, perhaps it might be worth it to check for an existing context first, before creating a new one? And only create a new context if none is already present.
This was an idea I had at the time, and something I might go ahead and add now. Adding a way to check if there currently is a context active can be useful both to SFML, external libraries (SFGUI included) and user code, it would save on all those temporary contexts that are currently created "just to be safe". The problem that they solved was a complicated one, which only arose when users would use these static functions before actually creating an SFML window. It completely messed up the internal context management, so this workaround was built in. Either way, I always try to make it less painful to work with SFML and external libraries that use OpenGL.
If there's good reasons not to do this, no problem. I'm just sharing a user experience with SFML here. It's one of the few times it's caused me some trouble.
It's nice of you to report such things. I know that this was an issue, but I didn't know how much impact it would have on the "daily lives" of developers. I guess now that it is obvious that it might cause a lot of time wastage a better solution has to be thought of.
I encourage all SFML users, no matter whether experienced or not, to always report such things. This is the only way we can judge whether changes we made in the past were acceptable and whether we need to change them again in the future.