Browse Source
creating only one gtk thread (#12830)
Co-authored-by: Herman Kirshin <herman.kirshin@jetbrains.com>
pull/12846/head
Herman K
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
1 deletions
-
src/Avalonia.X11/NativeDialogs/Gtk.cs
|
|
|
@ -256,9 +256,13 @@ namespace Avalonia.X11.NativeDialogs |
|
|
|
|
|
|
|
public static IntPtr GetForeignWindow(IntPtr xid) => gdk_x11_window_foreign_new_for_display(s_display, xid); |
|
|
|
|
|
|
|
static object s_startGtkLock = new(); |
|
|
|
static Task<bool> s_startGtkTask; |
|
|
|
|
|
|
|
public static Task<bool> StartGtk() |
|
|
|
{ |
|
|
|
return StartGtkCore(); |
|
|
|
lock (s_startGtkLock) |
|
|
|
return s_startGtkTask ??= StartGtkCore(); |
|
|
|
} |
|
|
|
|
|
|
|
private static void GtkThread(TaskCompletionSource<bool> tcs) |
|
|
|
|