Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AcessViolation in FileDrop event #32

Open
Ruannilton opened this issue Jun 21, 2020 · 1 comment
Open

AcessViolation in FileDrop event #32

Ruannilton opened this issue Jun 21, 2020 · 1 comment

Comments

@Ruannilton
Copy link

 private static void OnWindowFileDrop(object sender, FileDropEventArgs e)
    {
        foreach (var item in e.Filenames)
        {
            Console.WriteLine(item);
        }
    }

Exception:
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Runtime.InteropServices.Marshal.ReadByte(IntPtr, Int32)
at GLFW.Util.PtrToStringUTF8(IntPtr)
at GLFW.NativeWindow.OnFileDrop(Int32, IntPtr)
at GLFW.NativeWindow.b__115_4(IntPtr, Int32, IntPtr)
at GLFW.Glfw.WaitEvents()
at GLFW.Glfw.WaitEvents()
at Program.Main(System.String[])

@george-tsiros
Copy link

If you haven't fixed it already:

  1. how are you setting the callback? are you doing something like

GLFW.Glfw.SetDropCallback(Window, DropHandler) { //etc }

where DropHandler is the name of the method that does the handling?

If so, try defining a field of type GLFW.FileDropCallback and writing the "value" DropHandler to it after creating the window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants