vfaronov/gunison

Crash on Windows when first opening a diff

vfaronov opened this issue · 0 comments

On Windows, when you request a diff in Gunison, and Windows doesn’t recognize the .diff file type, it pops up a window to select an application. On my Windows 8.1 system, Gunison crashes either immediately when that window pops up, or once you make a selection in it. “exit status 3221226356” is printed to the console, which is 0xC0000374 = STATUS_HEAP_CORRUPTION.

If Windows already has an application associated with .diff, that application starts and Gunison doesn’t crash. The association can be reset by deleting the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.diff.

I couldn’t quickly reduce this to a reproducer program without GTK. May be some kind of conflict with GTK.

Gunison opens files via github.com/skratchdot/open-golang, which runs rundll32.exe url.dll,FileProtocolHandler. I tried replacing it with a direct call to ShellExecute, like this:

import "golang.org/x/sys/windows"
p, _ := windows.UTF16PtrFromString(pathToDiff)
windows.ShellExecute(0, nil, p, nil, nil, windows.SW_NORMAL)

— but this changed nothing.