Skip to content

Input related callbacks in GLFW cause an AccessViolationException #2026

Description

@vlOd2

Summary

When setting any input related callbacks in GLFW, PollEvents causes an AccessViolationException

Steps to reproduce

  • Platform: Desktop
  • Framework Version: .NET 4.7.2
  • API: OpenGL
  • API Version: Legacy/OpenGL 1.1 (I mostly use Silk.NET to port legacy games)
  1. Properly initialize a GLFW context and a window
  2. Use either SetKeyCallback, SetMouseButtonCallback or SetCursorPosCallback (probably others too)
  3. Call PollEvents

Comments

Oddly enough, SetWindowSizeCallback and other non-input related callbacks do not cause an access violation

// Leaving on this callback is fine
glfw.SetWindowSizeCallback(window, (WindowHandle* window, int width, int height) => 
{
	// Code is executed
	// ...
});
// But uncommenting this line, causes an AccessViolationException when polling the events
glfw.SetKeyCallback(window, (WindowHandle * window, Keys key, 
    int scanCode, InputAction action, KeyModifiers mods) =>
{
	// Code is not executed, game crashes
	// ...
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions