title: glfwGetFrameBufferSize crashes program with access violation
body: <p>I've been tryna write a renderer using BGFX, and I've set up a method to get the window width, and height - from my window class that wraps GLFWwindow*;</p>
  <p>Here is window.h:</p>
  <pre><code>#ifndef WINDOW_H
  #define WINDOW_H
  
  #include &lt;types.h&gt;
  #include &lt;string&gt;
  
  #define GLFW_INCLUDE_NONE
  #include &lt;GLFW/glfw3.h&gt;
  
  class RenderWindow {
  public:
      bool Init(u16 _width, u16 _height, std::string _title);
      bool IsCloseRequested() const;
  
      void* GetNativeWindow();
  
      u16 GetHeight();
      u16 GetWidth();
  
      void Refresh() const;
      
      GLFWwindow* GlfwWindowPointer = nullptr;
  };
  
  #endif
  </code></pre>
  <p>And here is window.cpp</p>
  <pre><code>#include &quot;window.h&quot;
  
  #ifdef _WIN32
  #define GLFW_EXPOSE_NATIVE_WIN32
  #elif __APPLE__
  #define GLFW_EXPOSE_NATIVE_COCOA
  #endif
  #include &lt;GLFW/glfw3native.h&gt;
  
  #include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  
  bool RenderWindow::Init(u16 _width, u16 _height, std::string _title) {
      glfwInit();
      glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
  
      this-&gt;GlfwWindowPointer = glfwCreateWindow(_width, _height, _title.c_str(), nullptr, nullptr);
      if(this-&gt;GlfwWindowPointer == nullptr) {
          std::cout &lt;&lt; &quot;[OS] [Window] [FATAL] Window creation failed, exiting&quot; &lt;&lt; std::endl;
          std::exit(10);
      }
  
      return true;
  }
  
  bool RenderWindow::IsCloseRequested() const {
      return glfwWindowShouldClose(this-&gt;GlfwWindowPointer);
  }
  
  void RenderWindow::Refresh() const {
      glfwPollEvents();
  }
  
  u16 RenderWindow::GetHeight() {
      int w = 0, h = 0;
      glfwGetFramebufferSize(&amp;(*GlfwWindowPointer), &amp;w, &amp;h); // ERROR HAPPENS HERE
      return h;
  }
  
  u16 RenderWindow::GetWidth() {
      int w = 0, h = 0;
      glfwGetFramebufferSize(&amp;(*GlfwWindowPointer), &amp;w, &amp;h); // ERROR HAPPENS HERE TOO
      return w;
  }
  
  void* RenderWindow::GetNativeWindow() {
      #ifdef _WIN32
      return glfwGetWin32Window(this-&gt;GlfwWindowPointer);
      #elif __APPLE__
      return glfwGetCocoaWindow(this-&gt;GlfwWindowPointer);
      #endif
  }
  </code></pre>
  <p>The thing is, whenever I call these methods - the program crashes in vs debugger with the message:</p>
  <pre><code>Exception thrown: read access violation.
  window was 0xF242340000.
  </code></pre>
  <p>Of course, the address changes every time - but you get the point. Without calling these two functions, my window works effortlessly. I even got bgfx to clear the screen to purple. Please help me.</p>