diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index b77ea28496..a990ad5c63 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -494,6 +494,16 @@ gtk_color_button_new_with_rgba (const GdkRGBA *rgba)
   return g_object_new (GTK_TYPE_COLOR_BUTTON, "rgba", rgba, NULL);
 }
 
+static gboolean
+dialog_delete_event (GtkWidget *dialog,
+                     GdkEvent  *event,
+                     gpointer   user_data)
+{
+  g_signal_emit_by_name (dialog, "response", GTK_RESPONSE_CANCEL);
+
+  return TRUE;
+}
+
 static gboolean
 dialog_destroy (GtkWidget *widget,
                 gpointer   data)
@@ -561,6 +571,8 @@ ensure_dialog (GtkColorButton *button)
                     G_CALLBACK (dialog_response), button);
   g_signal_connect (dialog, "destroy",
                     G_CALLBACK (dialog_destroy), button);
+  g_signal_connect (dialog, "delete-event",
+                    G_CALLBACK (dialog_delete_event), button);
 }
 
 
