Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2003-07-05 05:18:41 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2003-07-05 05:18:41 +0400
commitaa820ec42094c2799ca618d3ee174993358c9573 (patch)
tree41a122e1c1abf87dbe0911548568c1301a277cf2 /source/blender/python/api2_2x/EXPP_interface.c
parent20df091c042be721fae0cac911844d603f1dd140 (diff)
Exppython:
- Continued getting rid of print methods and updating repr ones: Needed to fix crashes on Windows >= 98 systems. - Found and fixed a few small memory leaks in EXPP_interface, related to execution of script links.
Diffstat (limited to 'source/blender/python/api2_2x/EXPP_interface.c')
-rw-r--r--source/blender/python/api2_2x/EXPP_interface.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/EXPP_interface.c b/source/blender/python/api2_2x/EXPP_interface.c
index d386bffcd48..56a71112c62 100644
--- a/source/blender/python/api2_2x/EXPP_interface.c
+++ b/source/blender/python/api2_2x/EXPP_interface.c
@@ -44,6 +44,7 @@
#include <DNA_scriptlink_types.h>
#include <DNA_world_types.h>
+#include "EXPP_interface.h"
#include "gen_utils.h"
#include "modules.h"
@@ -54,13 +55,21 @@ void initBlenderApi2_2x (void)
M_Blender_Init ();
}
+void discardFromBDict (char *key)
+{
+ PyObject *oldval = PyDict_GetItemString(g_blenderdict, key);
+ if (oldval) { Py_DECREF(oldval); }
+}
+
void clearScriptLinks (void)
{
+ discardFromBDict ("bylink");
Py_INCREF (Py_False);
PyDict_SetItemString (g_blenderdict, "bylink", Py_False);
/* Old API meant link could be unset. Or even valid when bylink is false.
* This way, you can import it and check its value afterwards, ignoring
* bylink. */
+ discardFromBDict ("link");
Py_INCREF (Py_None);
PyDict_SetItemString (g_blenderdict, "link", Py_None);
}
@@ -112,11 +121,13 @@ ScriptLink * setScriptLinks(ID *id, short event)
link = Py_None;
break;
default:
- Py_INCREF(Py_None);
- link = Py_None;
+ //Py_INCREF(Py_None);
+ //link = Py_None;
return NULL;
}
+ discardFromBDict ("bylink");
+
if (scriptlink == NULL)
{
/* This is probably not an internal error anymore :)
@@ -133,7 +144,10 @@ TODO: Check this
PyDict_SetItemString(g_blenderdict, "bylink", Py_True);
}
+ discardFromBDict ("link");
PyDict_SetItemString(g_blenderdict, "link", link);
+
+ discardFromBDict ("event");
PyDict_SetItemString(g_blenderdict, "event",
Py_BuildValue("s", event_to_name(event)));