Fixed Texture::getMaximumSize() breaking context management

Fixed a bug where calling Texture::getMaximumSize() before any GlResource is created would break context management.
Very suspicious line. If you try to accomplish a specific behavior, you should document it and use a less hacky way.

* What's the point of the temporary lock that locks and immediately unlocks the mutex?
* Why that strange use of the comma operator?
* This line has no effect in release mode.