Erik de Castro Lopo wrote:

> I'm not sure of the best way to fix this.

Attached is one possiblw way to fix this, not sure if its
the best way.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
# Subject: Fix segfault on shutdown.
# Author: Erik de Castro Lopo <[email protected]>
# Forwarded: yes
# Last-Update: 2010-09-23

=== modified file 'src/document.c'
Index: geany-bzr/src/document.c
===================================================================
--- geany-bzr.orig/src/document.c
+++ geany-bzr/src/document.c
@@ -701,6 +701,10 @@
 /* Opens a new empty document only if there are no other documents open */
 GeanyDocument *document_new_file_if_non_open(void)
 {
+	/* Notebook will be NULL if the program is in the process of being shut down. */
+	if (main_widgets.notebook == NULL)
+		return NULL;
+
 	if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0)
 		return document_new_file(NULL, NULL, NULL);
 
Index: geany-bzr/src/main.c
===================================================================
--- geany-bzr.orig/src/main.c
+++ geany-bzr/src/main.c
@@ -1213,6 +1213,12 @@
 	g_free(vte_info.lib_vte);
 	g_free(vte_info.dir);
 #endif
+
+    /* Setting the notebook pointer to NULL specifies that the application is
+     * about to be shutdown and that the function document_new_file_if_not_open()
+     * should not try to add a new document. */
+	main_widgets.notebook = NULL ;
+
 	gtk_widget_destroy(main_widgets.window);
 
 	/* destroy popup menus */
_______________________________________________
Geany-devel mailing list
[email protected]
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

Reply via email to