# Crash clicking multiple times immediately after glfwCreateWindow

**URL:** <https://discourse.glfw.org/t/crash-clicking-multiple-times-immediately-after-glfwcreatewindow/757>\
**Category:** support\
**Created:** [September 12, 2016, 6:36am UTC](https://discourse.glfw.org/t/crash-clicking-multiple-times-immediately-after-glfwcreatewindow/757 "2016-09-12T06:36:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdaset](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@tdaset](https://discourse.glfw.org/u/tdaset)\
**Post date:** [September 12, 2016, 6:36am UTC](https://discourse.glfw.org/t/crash-clicking-multiple-times-immediately-after-glfwcreatewindow/757/1 "2016-09-12T06:36:25Z")

</div>

100% Repro. Only occuring on a client machine so I am unable to trap the issue in a debugger. Windows 8.

First Call glfwCreateWindow with Fullscreen enabled (using glfwGetPrimaryMonitor)

Immediately after this call, clicking on the window with the Left Mouse (Right Mouse does nothing) repeatedly (10+ times) causes a crash that doesn’t get caught by my crash logger. It crashes straight to desktop, and no call stack is caught, nor does using SetUnhandledExceptionFilter seem to make any difference.

This crash occurs before even hooking up glfwSetMouseButtonCallback, but it still can occur after it is hooked up. If so, the Right Mouse button works fine and hits the callback, but the Left Mouse button does not invoke the callback at all and crashes if clicked too much.

If adding sleeps after the create window call, the crash will still occur, though it seems only between the sleep calls. For instance, adding a 5 second sleep after the call seems to make it so the crash will occur if you are clicking only right as the sleep is ending, 5 seconds after the window appears.

Immediately setting glfwSetInputMode to GLFW\_CURSOR\_DISABLED after creating the window appears to make no difference.

Sprinkling glfwPollEvents after creating the window and in between each glfw call appears to alleviate the issue somewhat. However, any long pause in time between calls to glfwPollEvents still causes a crash if you are clicking when the pause ends. Since this is happening during synchronous loading with huge pauses while textures are loaded to the GPU, dropping glfwPollEvents everywhere is not a real solution.

Code is single threaded. The create window function is called after a call to only glfwSetErrorCallback and glfwInit. Compiled in Visual Studio with /SUBSYSTEM:CONSOLE.

Client Machine with Repro  
Windows 8.1 Pro  
Intel Core i5-3317U CPU @ 1.70 GHz 1.70 GHz  
8.00 GB RAM  
64-bit Operating System x64 based processor

I can not repro the issue on any dev machine, ranging from various Win 7 boxes to mac boxes.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [September 12, 2016, 8:37am UTC](https://discourse.glfw.org/t/crash-clicking-multiple-times-immediately-after-glfwcreatewindow/757/2 "2016-09-12T08:37:37Z")

</div>

This doesn’t sound to be GLFW specific, so you may find other forums can give you more information.

There are some cases where SetUnhandledExceptionFilter won’t get called, see [this codeproject article on SetUnhandledExceptionFilter](http://www.codeproject.com/Articles/154686/SetUnhandledExceptionFilter-and-the-C-C-Runtime-Li) or [this Stackoverflow thread](http://stackoverflow.com/questions/13591334/what-actions-do-i-need-to-take-to-get-a-crash-dump-in-all-error-scenarios)

You might want to try getting your client to set crash dumps on, and send you a minidump (usually all you need). See [this MS article](https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx).

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [September 13, 2016, 10:25am UTC](https://discourse.glfw.org/t/crash-clicking-multiple-times-immediately-after-glfwcreatewindow/757/3 "2016-09-13T10:25:43Z")

</div>

You may also want to check out [CrashRpt](http://crashrpt.sourceforge.net/) as this is able to [handle different exception types](http://crashrpt.sourceforge.net/docs/html/exception_handling.html) as well as generating & sending minidumps for you.
