Commit a8fd3be3 authored by Paolo Maggi's avatar Paolo Maggi Committed by Paolo Maggi

does not allow python to manage SIGINT signal: this is needed to avoid the

2006-01-08  Paolo Maggi  <paolo@gnome.org>

	* gedit/gedit-python-module.c (gedit_python_module_init_python):
	does not allow python to manage SIGINT signal: this is needed to
avoid
	the crash reported on bug #326191 (Crash when pressing Ctrl+C
	from terminal)
parent 8a45f490
2006-01-08 Paolo Maggi <paolo@gnome.org>
* gedit/gedit-python-module.c (gedit_python_module_init_python):
does not allow python to manage SIGINT signal: this is needed to avoid
the crash reported on bug #326191 (Crash when pressing Ctrl+C
from terminal)
2006-01-07 Paolo Borelli <pborelli@katamail.com> 2006-01-07 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-plugins-engine.c: make sure the garbage collector * gedit/gedit-plugins-engine.c: make sure the garbage collector
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <config.h> #include <config.h>
#endif #endif
#include <signal.h>
#include <gmodule.h> #include <gmodule.h>
#include <pygobject.h> #include <pygobject.h>
...@@ -64,15 +66,44 @@ gedit_python_module_init_python () ...@@ -64,15 +66,44 @@ gedit_python_module_init_python ()
{ {
PyObject *pygtk, *mdict, *require, *path; PyObject *pygtk, *mdict, *require, *path;
PyObject *sys_path, *gedit, *gtk, *pygtk_version, *pygtk_required_version; PyObject *sys_path, *gedit, *gtk, *pygtk_version, *pygtk_required_version;
struct sigaction old_sigint;
gint res;
char *argv[] = { "gedit", NULL }; char *argv[] = { "gedit", NULL };
if (Py_IsInitialized ()) if (Py_IsInitialized ())
{ {
g_warning ("Python Should only be initted once, since it's in class_init"); g_warning ("Python Should only be initialized once, since it's in class_init");
g_return_if_reached (); g_return_if_reached ();
} }
/* Hack to make python not overwrite SIGINT: this is needed to avoid
* the crash reported on bug #326191 */
/* Save old handler */
res = sigaction (SIGINT, NULL, &old_sigint);
if (res != 0)
{
g_warning ("Error initializing Python interpreter: cannot get "
"handler to SIGINT signal (%s)",
strerror (errno));
return;
}
/* Python initialization */
Py_Initialize (); Py_Initialize ();
/* Restore old handler */
res = sigaction (SIGINT, &old_sigint, NULL);
if (res != 0)
{
g_warning ("Error initializing Python interpreter: cannot restore "
"handler to SIGINT signal (%s)",
strerror (errno));
return;
}
PySys_SetArgv (1, argv); PySys_SetArgv (1, argv);
/* pygtk.require("2.0") */ /* pygtk.require("2.0") */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment