Browse Source

Fix memory corruption on MSVC.

I can't believe that you can just forget to include some file and it
will SILENTLY PASS and then crashes horribly at runtime because each
translation unit thought that given member function pointer had
completely different size. THIS IS NOT ACCEPTABLE.
pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
69949b991a
  1. 7
      src/Magnum/Implementation/FramebufferState.h
  2. 7
      src/Magnum/Implementation/QueryState.h
  3. 7
      src/Magnum/Implementation/ShaderProgramState.h
  4. 7
      src/Magnum/Implementation/TextureState.h
  5. 12
      src/Magnum/Implementation/TransformFeedbackState.h

7
src/Magnum/Implementation/FramebufferState.h

@ -30,6 +30,13 @@
#include "Magnum/Framebuffer.h"
#ifdef _MSC_VER
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */
#include "Magnum/Renderbuffer.h"
#endif
namespace Magnum { namespace Implementation {
struct FramebufferState {

7
src/Magnum/Implementation/QueryState.h

@ -27,7 +27,14 @@
#include <vector>
#include "Magnum/Magnum.h"
#ifdef _MSC_VER
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */
#include "Magnum/AbstractQuery.h"
#endif
#if defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)
#error this header is not available in WebGL 1.0 build

7
src/Magnum/Implementation/ShaderProgramState.h

@ -31,6 +31,13 @@
#include "Magnum/Magnum.h"
#include "Magnum/OpenGL.h"
#ifdef _MSC_VER
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */
#include "Magnum/AbstractShaderProgram.h"
#endif
namespace Magnum { namespace Implementation {
struct ShaderProgramState {

7
src/Magnum/Implementation/TextureState.h

@ -30,6 +30,13 @@
#include "Magnum/CubeMapTexture.h"
#ifdef _MSC_VER
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */
#include "Magnum/BufferTexture.h"
#endif
namespace Magnum { namespace Implementation {
struct TextureState {

12
src/Magnum/Implementation/TransformFeedbackState.h

@ -25,7 +25,17 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/Context.h"
#include <vector>
#include "Magnum/Magnum.h"
#include "Magnum/OpenGL.h"
#ifdef _MSC_VER
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */
#include "Magnum/TransformFeedback.h"
#endif
#ifdef MAGNUM_TARGET_GLES2
#error this header is not available in OpenGL ES 2.0 build

Loading…
Cancel
Save