diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-11-23 13:40:03 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-11-23 13:40:03 +0100 |
| commit | 3dc72516fe915b5ba3722b11e07fb70211169509 (patch) | |
| tree | d45474126b6a9bad8c1c1bdf276df186d04ec58f /python/progress.cc | |
| parent | 14eafeeba30ccb31676769d708ad0aa681fab219 (diff) | |
| download | python-apt-3dc72516fe915b5ba3722b11e07fb70211169509.tar.gz | |
* python/progress.cc:
- fix refcount problem in OpProgress
- fix refcount problem in FetchProgress
- fix refcount problem in CdromProgress
Diffstat (limited to 'python/progress.cc')
| -rw-r--r-- | python/progress.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/python/progress.cc b/python/progress.cc index df9c2ec1..793265db 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -65,10 +65,11 @@ void PyOpProgress::Update() Py_XDECREF(o); // Build up the argument list... - PyObject *arglist = Py_BuildValue("(f)", Percent); if(CheckChange(0.05)) + { + PyObject *arglist = Py_BuildValue("(f)", Percent); RunSimpleCallback("update", arglist); - Py_XDECREF(arglist); + } }; void PyOpProgress::Done() @@ -163,14 +164,19 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) PyObject *o; o = Py_BuildValue("f", CurrentCPS); PyObject_SetAttrString(callbackInst, "currentCPS", o); + Py_XDECREF(o); o = Py_BuildValue("f", CurrentBytes); PyObject_SetAttrString(callbackInst, "currentBytes", o); + Py_XDECREF(o); o = Py_BuildValue("i", CurrentItems); PyObject_SetAttrString(callbackInst, "currentItems", o); + Py_XDECREF(o); o = Py_BuildValue("i", TotalItems); PyObject_SetAttrString(callbackInst, "totalItems", o); + Py_XDECREF(o); o = Py_BuildValue("f", TotalBytes); PyObject_SetAttrString(callbackInst, "totalBytes", o); + Py_XDECREF(o); PyObject *arglist = Py_BuildValue("()"); PyObject *result; @@ -306,6 +312,7 @@ void PyCdromProgress::Update(string text, int current) PyObject *o = Py_BuildValue("i", totalSteps); PyObject_SetAttrString(callbackInst, "totalSteps", o); + Py_XDECREF(o); RunSimpleCallback("update", arglist); } |
