diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-10-02 18:20:49 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-10-02 18:20:49 +0200 |
| commit | c00b2271e6295c248c18d1bd62e14df372004e85 (patch) | |
| tree | ed87936f9a2f5733f5891d247d6046f69a5ad9aa /python/progress.cc | |
| parent | ddfb5f9abcc398843e48885bbc8b3e4439c14e7b (diff) | |
| download | python-apt-c00b2271e6295c248c18d1bd62e14df372004e85.tar.gz | |
* progress.cc:
- fix memleak in progress.cc
* tests/memleak.py:
- uncomment the mem-leak code
* doc/examples/sources.py:
- improved the example
Diffstat (limited to 'python/progress.cc')
| -rw-r--r-- | python/progress.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/progress.cc b/python/progress.cc index f00058c9..df9c2ec1 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -18,8 +18,10 @@ bool PyCallbackObj::RunSimpleCallback(const char* method_name, PyObject *arglist, PyObject **res) { - if(callbackInst == 0) + if(callbackInst == 0) { + Py_XDECREF(arglist); return false; + } PyObject *method = PyObject_GetAttrString(callbackInst,(char*) method_name); if(method == NULL) { @@ -49,22 +51,24 @@ bool PyCallbackObj::RunSimpleCallback(const char* method_name, // OpProgress interface -// FIXME: add "string Op, string SubOp" as attribute to the callbackInst void PyOpProgress::Update() { - PyObject *o; o = Py_BuildValue("s", Op.c_str()); PyObject_SetAttrString(callbackInst, "op", o); + Py_XDECREF(o); o = Py_BuildValue("s", SubOp.c_str()); PyObject_SetAttrString(callbackInst, "subOp", o); + Py_XDECREF(o); o = Py_BuildValue("b", MajorChange); PyObject_SetAttrString(callbackInst, "majorChange", o); + Py_XDECREF(o); // Build up the argument list... PyObject *arglist = Py_BuildValue("(f)", Percent); if(CheckChange(0.05)) RunSimpleCallback("update", arglist); + Py_XDECREF(arglist); }; void PyOpProgress::Done() |
