fix polkit-gnome crashes under wayland

This commit is contained in:
Alexej Kowalew 2022-01-05 21:47:23 +01:00
parent a945089e90
commit 396f57895f

View File

@ -16,13 +16,22 @@ Index: policykit-1-gnome-0.105/src/polkitgnomeauthenticator.c
#include <polkit/polkit.h> #include <polkit/polkit.h>
#include <polkitagent/polkitagent.h> #include <polkitagent/polkitagent.h>
@@ -307,7 +308,8 @@ @@ -307,7 +308,17 @@
} }
gtk_widget_show_all (GTK_WIDGET (authenticator->dialog)); gtk_widget_show_all (GTK_WIDGET (authenticator->dialog));
- gtk_window_present (GTK_WINDOW (authenticator->dialog)); - gtk_window_present (GTK_WINDOW (authenticator->dialog));
+ gtk_window_present_with_time (GTK_WINDOW (authenticator->dialog), + GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (authenticator->dialog));
+ gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (authenticator->dialog)))); +
+ if (GDK_IS_X11_WINDOW (window))
+ {
+ gtk_window_present_with_time (GTK_WINDOW (authenticator->dialog), gdk_x11_get_server_time (window));
+ }
+ else
+ {
+ gtk_window_present (GTK_WINDOW (authenticator->dialog));
+ }
+
password = polkit_gnome_authentication_dialog_run_until_response_for_prompt (POLKIT_GNOME_AUTHENTICATION_DIALOG (authenticator->dialog), password = polkit_gnome_authentication_dialog_run_until_response_for_prompt (POLKIT_GNOME_AUTHENTICATION_DIALOG (authenticator->dialog),
modified_request, modified_request,
echo_on, echo_on,