Fixes bug #910 - installEventFilter() increments reference count on target object.

http://bugs.pyside.org/show_bug.cgi?id=910

Also added/fixed unit tests.

Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
Marcelo Lira 2011-07-19 15:58:20 -03:00
commit 2e98f87d20
3 changed files with 39 additions and 13 deletions

View file

@ -2,7 +2,7 @@ import unittest
import sys
from helper import UsesQApplication
from PySide.QtCore import QObject, QEvent, QTimer
from PySide.QtCore import QObject, QEvent
from PySide.QtGui import QWidget
class MyFilter(QObject):
@ -17,10 +17,10 @@ class EventFilter(UsesQApplication):
o = QObject()
filt = MyFilter()
o.installEventFilter(filt)
self.assertEqual(sys.getrefcount(o), 3)
self.assertEqual(sys.getrefcount(o), 2)
o.installEventFilter(filt)
self.assertEqual(sys.getrefcount(o), 3)
self.assertEqual(sys.getrefcount(o), 2)
o.removeEventFilter(filt)
self.assertEqual(sys.getrefcount(o), 2)