summaryrefslogtreecommitdiff
path: root/plugins/pychrysa
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-01-02 00:57:00 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-01-02 00:57:00 (GMT)
commitb79c07f827f487e380392ae70bf23f50805236d4 (patch)
tree10da9b00de1c4f300f34c0f7184342bc1e3bc98d /plugins/pychrysa
parent96fc5ec3edf4b2391be52c3932d5ad5553b93186 (diff)
Fixed major issues with wrong Python refcounting.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@364 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa')
-rw-r--r--plugins/pychrysa/gui/panels/panel.c1
-rw-r--r--plugins/pychrysa/plugin.c73
-rw-r--r--plugins/pychrysa/pychrysa.c2
3 files changed, 4 insertions, 72 deletions
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index fc261b5..7aa5fa7 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -101,6 +101,7 @@ PyObject *_py_panel_item_from_c(GPanelItem *item, PyTypeObject *type)
module = PyImport_ImportModule("pychrysalide.gui.panels");
type = (PyTypeObject *)PyObject_GetAttrString(module, "PanelItem");
Py_DECREF(module);
+ /* FIXME : type refcount ? */
}
else Py_INCREF(type);
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index dd2517b..05d56d0 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -134,70 +134,6 @@ static PyObject *pychrysa_plugin_handle_debugger(PyObject *, PyObject *);
-#if 0
-
-
-
-int
-main2(const char *filename, const char *method)
-{
- PyObject *pName, *pModule, *pDict, *pFunc;
- PyObject *pArgs, *pValue;
- int i;
- return 0;
- pName = PyString_FromString/*PyUnicode_FromString*/(filename);
- /* Error checking of pName left out */
-
- pModule = PyImport_Import(pName);
- Py_DECREF(pName);
-
- if (pModule != NULL) {
- pFunc = PyObject_GetAttrString(pModule, method);
- /* pFunc is a new reference */
-
- if (pFunc && PyCallable_Check(pFunc)) {
- pArgs = PyTuple_New(0/*argc - 3*/);
-
- pValue = PyObject_CallObject(pFunc, pArgs);
- Py_DECREF(pArgs);
- if (pValue != NULL) {
- printf("Result of call: %ld\n", PyLong_AsLong(pValue));
- Py_DECREF(pValue);
- }
- else {
- Py_DECREF(pFunc);
- Py_DECREF(pModule);
- PyErr_Print();
- fprintf(stderr,"Call failed\n");
- return 1;
- }
- }
- else {
- if (PyErr_Occurred())
- PyErr_Print();
- fprintf(stderr, "Cannot find function \"%s\"\n", method);
- }
- Py_XDECREF(pFunc);
- Py_DECREF(pModule);
- }
- else {
- PyErr_Print();
- fprintf(stderr, "Failed to load \"%s\"\n", filename);
- return 1;
- }
- return 0;
-}
-
-
-#endif
-
-
-
-
-
-
-
-
@@ -296,7 +232,6 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
dict = PyModule_GetDict(module);
class = PyDict_GetItemString(dict, modname);
- Py_DECREF(dict);
if (class == NULL) goto gppn_no_class;
if (!PyType_Check(class->ob_type)) goto gppn_no_class;
@@ -304,8 +239,6 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
instance = PyObject_CallFunction(class, NULL);
if (instance == NULL) goto gppn_no_instance;
- Py_DECREF(class);
-
result = g_object_new(G_TYPE_PYTHON_PLUGIN, NULL);
G_PLUGIN_MODULE(result)->name = strdup(modname);
@@ -324,8 +257,6 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
gppn_no_instance:
- Py_DECREF(class);
-
gppn_no_class:
Py_DECREF(module);
@@ -762,9 +693,9 @@ static PyObject *pychrysa_plugin_is_matching(PyObject *self, PyObject *args)
result = PyTuple_New(3);
PyTuple_SetItem(result, 0, PyInt_FromLong(MFA_NONE));
- Py_DECREF(Py_None);
+ //Py_DECREF(Py_None);
PyTuple_SetItem(result, 1, Py_None);
- Py_DECREF(Py_None);
+ //Py_DECREF(Py_None);
PyTuple_SetItem(result, 2, Py_None);
return result;
diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c
index e7491ce..ee94f31 100644
--- a/plugins/pychrysa/pychrysa.c
+++ b/plugins/pychrysa/pychrysa.c
@@ -129,7 +129,7 @@ bool init_plugin(GPluginModule *plugin, GObject *ref)
Py_Initialize();
- pychrysalide_set_gc_threshold(INT_MAX, INT_MAX, INT_MAX);
+ //pychrysalide_set_gc_threshold(INT_MAX, INT_MAX, INT_MAX);
//pychrysalide_set_gc_threshold(1, 1, 1);
initpychrysa();