title: OpenGL glfwGetVideoMode causes seg fault
body: <p>I have a simple program where I want to check the formatting of my GLFW window but <code>glfwGetVideoMode</code> causes a segfault.</p>
  <p>Here is my code:</p>
  <pre class="lang-cpp prettyprint-override"><code>        if (!glfwInit()) {
              VI_ERROR(&quot;Couldn't init GLFW\n&quot;);
              exit(0);
          }
  
          glfwWindowHint(GLFW_SAMPLES, 6);
  
  
          window = glfwCreateWindow(gl_width, gl_height, &quot;GLFW Context&quot;, NULL, NULL);
  
          if (!window) {
              VI_ERROR(&quot;Couldn't open window\n&quot;);
              exit(0);
          }
  
          glfwMakeContextCurrent(window);
  
          gladLoadGL();
  
          GLFWmonitor* wmonitor = glfwGetWindowMonitor(window);
  
          glfwGetVideoMode(wmonitor);
  </code></pre>
  <p>Valgrind says this:</p>
  <pre><code>==56501== Invalid read of size 8
  ==56501==    at 0xDF31CB: _glfwPlatformGetVideoMode (in /home/turgut/Desktop/CppProjects/videoo-render/bin/Renderer)
  ==56501==    by 0xDEDE51: glfwGetVideoMode (in /home/turgut/Desktop/CppProjects/videoo-render/bin/Renderer)
  ==56501==    by 0x21F8F6: OpenGL::OpenGLRenderer::OpenGLRenderer(int, int, int, int) (OpenGLRenderer.cpp:27)
  ==56501==    by 0x21BC7A: Application::Run() (Application.cpp:77)
  ==56501==    by 0x21AB6E: main (main.cpp:18)
  ==56501==  Address 0x108 is not stack'd, malloc'd or (recently) free'd
  ==56501== 
  ==56501== 
  ==56501== Process terminating with default action of signal 11 (SIGSEGV)
  ==56501==  Access not within mapped region at address 0x108
  ==56501==    at 0xDF31CB: _glfwPlatformGetVideoMode (in /home/turgut/Desktop/CppProjects/videoo-render/bin/Renderer)
  ==56501==    by 0xDEDE51: glfwGetVideoMode (in /home/turgut/Desktop/CppProjects/videoo-render/bin/Renderer)
  ==56501==    by 0x21F8F6: OpenGL::OpenGLRenderer::OpenGLRenderer(int, int, int, int) (OpenGLRenderer.cpp:27)
  ==56501==    by 0x21BC7A: Application::Run() (Application.cpp:77)
  ==56501==    by 0x21AB6E: main (main.cpp:18)
  ==56501==  If you believe this happened as a result of a stack
  ==56501==  overflow in your program's main thread (unlikely but
  ==56501==  possible), you can try to increase the size of the
  ==56501==  main thread stack using the --main-stacksize= flag.
  ==56501==  The main thread stack size used in this run was 8388608.
  
  </code></pre>
  <p>What could I be doing wrong? It's as simple as it gets.</p>