[yelp/gnome-3-0] Fix crash when opening URI after closing a window
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/gnome-3-0] Fix crash when opening URI after closing a window
- Date: Sat, 25 Jun 2011 00:49:10 +0000 (UTC)
commit e89ee12de26bf427d52f2ad85e8f27f75a121d14
Author: Shaun McCance <shaunm gnome org>
Date: Fri Jun 24 20:46:34 2011 -0400
Fix crash when opening URI after closing a window
I had the right code for this. It got accidentally removed with the
late-cycle port to GApplication.
src/yelp-application.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 94f13ae..1966500 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -88,6 +88,9 @@ static int yelp_application_command_line (GApplication *a
GApplicationCommandLine *cmdline);
static void application_uri_resolved (YelpUri *uri,
YelpApplicationLoad *data);
+static gboolean application_window_deleted (YelpWindow *window,
+ GdkEvent *event,
+ YelpApplication *app);
GSettings * application_get_doc_settings (YelpApplication *app,
const gchar *doc_uri);
static void application_adjust_font (GtkAction *action,
@@ -451,6 +454,8 @@ application_uri_resolved (YelpUri *uri,
g_free (doc_uri);
}
+ g_signal_connect (window, "delete-event",
+ G_CALLBACK (application_window_deleted), data->app);
gtk_window_set_application (GTK_WINDOW (window),
GTK_APPLICATION (data->app));
}
@@ -481,6 +486,22 @@ application_uri_resolved (YelpUri *uri,
g_free (data);
}
+static gboolean
+application_window_deleted (YelpWindow *window,
+ GdkEvent *event,
+ YelpApplication *app)
+{
+ gchar *doc_uri; /* owned by windows_by_document */
+ YelpApplicationPrivate *priv = GET_PRIV (app);
+
+ priv->windows = g_slist_remove (priv->windows, window);
+ doc_uri = g_object_get_data (G_OBJECT (window), "doc_uri");
+ if (doc_uri)
+ g_hash_table_remove (priv->windows_by_document, doc_uri);
+
+ return FALSE;
+}
+
GSettings *
application_get_doc_settings (YelpApplication *app, const gchar *doc_uri)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]