Closed ncruces closed 9 months ago
Thinking of merging this regardless, wdyt @lonnywong?
Thinking of merging this regardless, wdyt @lonnywong?
Sorry for the delay. It doesn't work on that machine. It may fall back to GetOpenFileName
, I'd like to try debugging to confirm, but he's not free recently.
That's disappointing. If you can help debug, it'd be great. I'll test more just to see if this big change isn't a regression. And I'll probably merge it too.
@ncruces It crashes without falling back to GetOpenFileName
.
Should we use the solution https://github.com/ncruces/zenity/pull/89/commits/84d5fe5fb3c2a724ce313d340487a01300e1cc8d ? It works with the patch.
If we're going to leave COM initialized, windows can do it for us.
When it returns S_OK
(nil
), we leave it initialized.
When it returns S_FALSE
, it was already initialized, so we can CoUninitialize
(drop the ref count back to what it was).
When it returns RPC_E_CHANGED_MODE
, we asked it to change mode, but we don't care about the mode.
Otherwise, it's an error.
@ncruces Thanks.
https://github.com/ncruces/zenity/pull/89 has been fixed by https://github.com/ncruces/zenity/commit/99f1a258bcfc7eaa8b3a90332e51ae06f8768454: https://github.com/ncruces/zenity/blob/99f1a258bcfc7eaa8b3a90332e51ae06f8768454/file_windows.go#L453-L472
As long as the reference count does not decrease to 0
, the bug will not be triggered.
That was the expectation, great to see it confirmed! It just felt better to leave it to windows to manage the thread local stuff.
Alternative fix for #89.