diff --git a/configure.ac b/configure.ac
index 2ae8f432..195d36d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,7 +62,7 @@ case "$with_gtk" in
   3.0) GTK_API_VERSION=3.0
        GTK_REQUIRED=3.12.0
        GTK_MIN_REQUIRED=3.8
-       GTK_MAX_ALLOWED=3.20
+       GTK_MAX_ALLOWED=3.22
        VTE_API_VERSION=2.91
        VTE_REQUIRED=0.51.3
        ;;
diff --git a/src/terminal-prefs.c b/src/terminal-prefs.c
index 41441198..11b255b0 100644
--- a/src/terminal-prefs.c
+++ b/src/terminal-prefs.c
@@ -249,29 +249,17 @@ profile_make_default_cb (GSimpleAction *simple,
 }
 
 
-static void
-popover_dialog_ok_clicked_cb (GtkButton *button,
-                              void (*fn) (const char *));
-
 static void
 popover_dialog_cancel_clicked_cb (GtkButton *button,
                                   gpointer user_data)
 {
-  GtkEntry *entry = GTK_ENTRY (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-entry"));
-  gtk_entry_set_text (entry, "");
-
-  GtkButton *ok = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-ok"));
-  GtkButton *cancel = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-cancel"));
-
-  g_signal_handlers_disconnect_matched (ok, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
-                                        G_CALLBACK (popover_dialog_ok_clicked_cb), NULL);
-  g_signal_handlers_disconnect_matched (cancel, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
-                                        G_CALLBACK (popover_dialog_cancel_clicked_cb), NULL);
-
   GtkPopover *popover_dialog = GTK_POPOVER (gtk_builder_get_object (the_pref_data->builder, "popover-dialog"));
 
-  /* FIXME use gtk_popover_popdown, see the comment at the corresponding gtk_widget_show */
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_popover_popdown (popover_dialog);
+#else
   gtk_widget_hide (GTK_WIDGET (popover_dialog));
+#endif
 }
 
 static void
@@ -284,10 +272,29 @@ popover_dialog_ok_clicked_cb (GtkButton *button,
   /* Perform what we came for */
   (*fn) (name);
 
-  /* Do anything we'd do if "cancel" was clicked */
+  /* Hide/popdown the popover */
   popover_dialog_cancel_clicked_cb (button, NULL);
 }
 
+static void
+popover_dialog_closed_cb (GtkPopover *popover,
+                          gpointer   user_data)
+{
+
+  GtkEntry *entry = GTK_ENTRY (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-entry"));
+  gtk_entry_set_text (entry, "");
+
+  GtkButton *ok = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-ok"));
+  GtkButton *cancel = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-cancel"));
+
+  g_signal_handlers_disconnect_matched (ok, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+                                        G_CALLBACK (popover_dialog_ok_clicked_cb), NULL);
+  g_signal_handlers_disconnect_matched (cancel, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+                                        G_CALLBACK (popover_dialog_cancel_clicked_cb), NULL);
+  g_signal_handlers_disconnect_matched (popover, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+                                        G_CALLBACK (popover_dialog_closed_cb), NULL);
+}
+
 
 /* Updates the OK button's sensitivity (insensitive if entry field is empty or whitespace only).
  * The entry's initial value and OK's initial sensitivity have to match in the .ui file. */
@@ -333,17 +340,17 @@ profile_popup_dialog (GtkWidget *relative_to,
 
   g_signal_connect (ok, "clicked", G_CALLBACK (popover_dialog_ok_clicked_cb), fn);
   g_signal_connect (cancel, "clicked", G_CALLBACK (popover_dialog_cancel_clicked_cb), NULL);
+  g_signal_connect (popover_dialog, "closed", G_CALLBACK (popover_dialog_closed_cb), NULL);
 
   gtk_popover_set_relative_to (popover_dialog, relative_to);
   gtk_popover_set_position (popover_dialog, GTK_POS_BOTTOM);
   gtk_popover_set_default_widget (popover_dialog, GTK_WIDGET (ok));
 
-  /* FIXME use gtk_popover_popup/popdown with GTK+ >= 3.22.
-   * With this change, deletion of a profile rarely renamed it to "." instead (the text
-   * used in the hidden entry widget at delete confirmation). I couldn't reliably reproduce it.
-   * Must have something to do with the asynchronous nature of popup/popdown, e.g. the button
-   * getting pressed during popup/popdown animation, or something similarly nasty... */
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_popover_popup (popover_dialog);
+#else
   gtk_widget_show (GTK_WIDGET (popover_dialog));
+#endif
 
   gtk_widget_grab_focus (entry_text != NULL ? GTK_WIDGET (entry) : GTK_WIDGET (cancel));
 }
