Every call to CoInitialize() must be balanced
with a call to CoUninitialize()
This commit is contained in:
parent
823df3ed70
commit
9022ac596b
|
@ -61,9 +61,6 @@ public interface Application : GLib.Application {
|
||||||
});
|
});
|
||||||
shutdown.connect(() => {
|
shutdown.connect(() => {
|
||||||
stream_interactor.connection_manager.make_offline_all();
|
stream_interactor.connection_manager.make_offline_all();
|
||||||
#if _WIN32
|
|
||||||
Dino.Util.CoUninitialize();
|
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
open.connect((files, hint) => {
|
open.connect((files, hint) => {
|
||||||
if (files.length != 1) {
|
if (files.length != 1) {
|
||||||
|
|
|
@ -8,14 +8,17 @@ public class Util {
|
||||||
private static extern int ShellExecuteA(int* hwnd, string operation, string file, string parameters, string directory, int showCmd);
|
private static extern int ShellExecuteA(int* hwnd, string operation, string file, string parameters, string directory, int showCmd);
|
||||||
|
|
||||||
[CCode (cname = "CoInitialize")]
|
[CCode (cname = "CoInitialize")]
|
||||||
public static extern int CoInitialize(void* reserved);
|
private static extern int CoInitialize(void* reserved);
|
||||||
|
|
||||||
[CCode (cname = "CoUninitialize")]
|
[CCode (cname = "CoUninitialize")]
|
||||||
public static extern void CoUninitialize();
|
private static extern void CoUninitialize();
|
||||||
|
|
||||||
private static int ShellExecute(string operation, string file) {
|
private static int ShellExecute(string operation, string file) {
|
||||||
CoInitialize(null);
|
CoInitialize(null);
|
||||||
return ShellExecuteA(null, operation, file, null, null, 1);
|
var result = ShellExecuteA(null, operation, file, null, null, 1);
|
||||||
|
CoUninitialize();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,7 +49,7 @@ public class Util {
|
||||||
public static void launch_default_for_uri(string file_uri)
|
public static void launch_default_for_uri(string file_uri)
|
||||||
{
|
{
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
Dino.Util.ShellExecute("open", file_uri);
|
ShellExecute("open", file_uri);
|
||||||
#else
|
#else
|
||||||
AppInfo.launch_default_for_uri(file_uri, null);
|
AppInfo.launch_default_for_uri(file_uri, null);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue