summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Geddes <vgeddes@src.gnome.org>2007-07-03 21:19:03 +0000
committerVincent Geddes <vgeddes@src.gnome.org>2007-07-03 21:19:03 +0000
commitdaf67732bb8a288387fe49b38c2e866605f773f9 (patch)
tree6b75703aed9a711d9a6b9362fa93da3ca64dd5de
parent75032ddc5ad97a624f7d8f38735f6380d47c9825 (diff)
downloadglade-daf67732bb8a288387fe49b38c2e866605f773f9.tar.gz
Upgrade to g_slice_new().
* gladeui/glade-binding.c: Upgrade to g_slice_new(). * bindings/python/glade-python.c: Run garbage collector before finalizing interpreter. Use Py_InitializeEx() instead of Py_Initialize() (#453104). svn path=/trunk/; revision=1430
-rw-r--r--ChangeLog7
-rw-r--r--bindings/python/glade-python.c18
-rw-r--r--gladeui/glade-binding.c12
3 files changed, 26 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 1362bb42..66b1d0ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-03 Vincent Geddes <vgeddes@gnome.org>
+
+ * gladeui/glade-binding.c: Upgrade to g_slice_new().
+
+ * bindings/python/glade-python.c: Run garbage collector before finalizing
+ interpreter. Use Py_InitializeEx() instead of Py_Initialize() (#453104).
+
2007-07-03 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* plugins/gtk+/gtk+.xml.in: fixed verify-function and child-verify-function tags
diff --git a/bindings/python/glade-python.c b/bindings/python/glade-python.c
index 8fe04c0a..17aa9dd0 100644
--- a/bindings/python/glade-python.c
+++ b/bindings/python/glade-python.c
@@ -22,12 +22,12 @@
#include <config.h>
-#include <Python.h>
-#include <pygobject.h>
-
#include <gladeui/glade.h>
#include <gladeui/glade-binding.h>
+#include <Python.h>
+#include <pygobject.h>
+
static PyObject *gladeui, *gladeui_dict, *GladeuiError;
extern PyTypeObject PyGladeWidgetAdaptor_Type;
@@ -90,7 +90,13 @@ static PyMethodDef GladeuiMethods[] = {
void
glade_python_binding_finalize (GladeBindingCtrl *ctrl)
{
- Py_Finalize ();
+ if (Py_IsInitialized ())
+ {
+ while (PyGC_Collect ())
+ ;
+
+ Py_Finalize ();
+ }
}
void
@@ -112,8 +118,8 @@ glade_python_init (void)
{
char *argv[2] = {"", NULL};
- /* Init interpreter */
- Py_Initialize ();
+ Py_InitializeEx (0);
+
PySys_SetArgv (1, argv);
}
diff --git a/gladeui/glade-binding.c b/gladeui/glade-binding.c
index 686da949..d6674980 100644
--- a/gladeui/glade-binding.c
+++ b/gladeui/glade-binding.c
@@ -85,7 +85,7 @@ glade_binding_load_all (void)
if (module == NULL) continue;
- binding = g_new0 (GladeBinding, 1);
+ binding = g_slice_new0 (GladeBinding);
binding->module = module;
if ((g_module_symbol (module, "glade_binding_init", (gpointer)&init) &&
@@ -93,7 +93,7 @@ glade_binding_load_all (void)
{
g_warning ("Unable to load GladeBinding module '%s'", path);
g_module_close (module);
- g_free (binding);
+ g_slice_free (GladeBinding, binding);
g_free (path);
continue;
}
@@ -110,11 +110,12 @@ glade_binding_remove (gpointer key, gpointer value, gpointer user_data)
{
GladeBinding *binding = value;
- if (binding->ctrl.finalize) binding->ctrl.finalize (&binding->ctrl);
+ if (binding->ctrl.finalize)
+ binding->ctrl.finalize (&binding->ctrl);
g_module_close (binding->module);
- g_free (binding);
+ g_slice_free (GladeBinding, binding);
}
/**
@@ -126,7 +127,8 @@ glade_binding_remove (gpointer key, gpointer value, gpointer user_data)
void
glade_binding_unload_all (void)
{
- if (bindings == NULL) return;
+ if (bindings == NULL)
+ return;
g_hash_table_foreach (bindings, glade_binding_remove, NULL);
g_hash_table_destroy (bindings);