From 37930527264d021c4ea352b679d1d2ec0294fee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Str=C3=A1nsk=C3=BD?= Date: Wed, 2 Dec 2009 15:01:50 -0600 Subject: [PATCH] Bug 531580 - ""gtk_clipboard_get_for_display: assertion `!display->closed' failed" after closing browser" [r=karlt] --- widget/src/gtk2/nsClipboard.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/widget/src/gtk2/nsClipboard.cpp b/widget/src/gtk2/nsClipboard.cpp index c7368faa337..1e470317c79 100644 --- a/widget/src/gtk2/nsClipboard.cpp +++ b/widget/src/gtk2/nsClipboard.cpp @@ -121,18 +121,26 @@ clipboard_text_received(GtkClipboard *clipboard, gpointer data); nsClipboard::nsClipboard() -{ +{ } nsClipboard::~nsClipboard() { + // We have to clear clipboard before gdk_display_close() call. + // See bug 531580 for details. + if (mGlobalTransferable) { + gtk_clipboard_clear(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)); + } + if (mSelectionTransferable) { + gtk_clipboard_clear(gtk_clipboard_get(GDK_SELECTION_PRIMARY)); + } } NS_IMPL_ISUPPORTS1(nsClipboard, nsIClipboard) nsresult nsClipboard::Init(void) -{ +{ nsresult rv; nsCOMPtr os (do_GetService("@mozilla.org/observer-service;1", &rv));