pidgin: 119df205: Uninitialize the python interpreter only...

sadrul at pidgin.im sadrul at pidgin.im
Mon Mar 17 22:10:38 EDT 2008


-----------------------------------------------------------------
Revision: 119df2055ed7ee5143047b4d18ae81d58c2feac6
Ancestor: 86f0d791b2c9e5b64c8cf03fd53a9e1e5d3a018a
Author: sadrul at pidgin.im
Date: 2008-03-18T02:13:24
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/119df2055ed7ee5143047b4d18ae81d58c2feac6

Modified files:
        finch/libgnt/gntwm.c

ChangeLog: 

Uninitialize the python interpreter only if gnt started it. This fixes a crash when quitting pygnt apps.

-------------- next part --------------
============================================================
--- finch/libgnt/gntwm.c	6e1623a36db652b8fd0af9796784423cd8bc3dc2
+++ finch/libgnt/gntwm.c	f21ad7bc460258463db362f8d6d7b15e704ca40d
@@ -101,6 +101,7 @@ static gboolean ignore_keys = FALSE;
 static gboolean idle_update;
 static GList *act = NULL; /* list of WS with unseen activitiy */
 static gboolean ignore_keys = FALSE;
+static gboolean started_python = FALSE;
 
 static GList *
 g_list_bring_to_front(GList *list, gpointer data)
@@ -1342,7 +1343,10 @@ gnt_wm_destroy(GObject *obj)
 		wm->workspaces = g_list_delete_link(wm->workspaces, wm->workspaces);
 	}
 #ifdef USE_PYTHON
-	Py_Finalize();
+	if (started_python) {
+		Py_Finalize();
+		started_python = FALSE;
+	}
 #endif
 }
 
@@ -1523,8 +1527,11 @@ gnt_wm_class_init(GntWMClass *klass)
 #ifdef USE_PYTHON
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "run-python", run_python,
 				GNT_KEY_F3, NULL);
-	Py_SetProgramName("gnt");
-	Py_Initialize();
+	if (!Py_IsInitialized()) {
+		Py_SetProgramName("gnt");
+		Py_Initialize();
+		started_python = TRUE;
+	}
 #endif
 
 	gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass));


More information about the Commits mailing list