vslavik / winsparkle

App update framework for Windows, inspired by Sparkle for macOS
http://winsparkle.org
Other
1.31k stars 267 forks source link

install window hangs until Windows event received #136

Closed ammmir closed 7 years ago

ammmir commented 7 years ago

Thanks for writing this library. I'm not sure if this is the correct place to post this, so please let me know otherwise.

I have integrated WinSparkle into a tray menu app (written in Go if it matters) with no visible windows. On startup (before starting the Windows event loop), the app calls:

win_sparkle_init();
win_sparkle_set_can_shutdown_callback(...);
win_sparkle_set_shutdown_request_callback(...);

A menu item calls win_sparkle_check_update_with_ui() but when I click the final install button, the update window hangs (i.e., application not responding) until I move the mouse over the tray icon. Basically, the win_sparkle_can_shutdown_callback isn't called until I hover the mouse. After doing that, the callbacks execute and the update succeeds. What could be causing this behavior?

I was under the impression that the WinSparkle UI thread is completely separate and unrelated to the main application message pump. Mine looks something like (in Go):

for win.GetMessage(&msg, 0, 0, 0) > 0 {
    win.TranslateMessage(&msg)
    win.DispatchMessage(&msg)
}

Does WinSparkle expect the main UI thread or the WndProc to handle some specific messages?

vslavik commented 7 years ago

Basically, the win_sparkle_can_shutdown_callback isn't called until I hover the mouse.

That's neither true (as just reading the code would tell you) nor a reasonable thing to assume.

Review your code — that's a more reasonable first assumption, especially when bridging languages. If your code is doing any cross-thread communication or async execution, there's your culprit. If not, use a debugger to figure out where the problem is… and if it is in WinSparkle, you'll be able to provide actionable details.

Does WinSparkle expect the main UI thread or the WndProc to handle some specific messages?

No. Documentation would mention such a crucial requirement, wouldn't it?