Fix bug 652 - "Segfault when using QTextBlock::setUserData due to missing ownership transfer"
This commit is contained in:
parent
a7e1ccf127
commit
fac9507d3e
3 changed files with 36 additions and 0 deletions
|
|
@ -491,6 +491,11 @@
|
||||||
<modify-function signature="operator++(int)" remove="all"/>
|
<modify-function signature="operator++(int)" remove="all"/>
|
||||||
<modify-function signature="operator--(int)" remove="all"/>
|
<modify-function signature="operator--(int)" remove="all"/>
|
||||||
</value-type>
|
</value-type>
|
||||||
|
<modify-function signature="setUserData(QTextBlockUserData*)">
|
||||||
|
<modify-argument index="1">
|
||||||
|
<parent index="this" action="add"/>
|
||||||
|
</modify-argument>
|
||||||
|
</modify-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QTextBlockFormat" />
|
<value-type name="QTextBlockFormat" />
|
||||||
<value-type name="QTextTableCellFormat" />
|
<value-type name="QTextTableCellFormat" />
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ PYSIDE_TEST(bug_585.py)
|
||||||
PYSIDE_TEST(bug_589.py)
|
PYSIDE_TEST(bug_589.py)
|
||||||
PYSIDE_TEST(bug_617.py)
|
PYSIDE_TEST(bug_617.py)
|
||||||
PYSIDE_TEST(bug_640.py)
|
PYSIDE_TEST(bug_640.py)
|
||||||
|
PYSIDE_TEST(bug_652.py)
|
||||||
PYSIDE_TEST(customproxywidget_test.py)
|
PYSIDE_TEST(customproxywidget_test.py)
|
||||||
PYSIDE_TEST(deepcopy_test.py)
|
PYSIDE_TEST(deepcopy_test.py)
|
||||||
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
|
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
|
||||||
|
|
|
||||||
30
tests/QtGui/bug_652.py
Normal file
30
tests/QtGui/bug_652.py
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
import unittest
|
||||||
|
from PySide.QtGui import *
|
||||||
|
|
||||||
|
class MyData(QTextBlockUserData):
|
||||||
|
def __init__(self, data):
|
||||||
|
QTextBlockUserData.__init__(self)
|
||||||
|
self.data = data
|
||||||
|
|
||||||
|
def getMyNiceData(self):
|
||||||
|
return self.data
|
||||||
|
|
||||||
|
class TestBug652(unittest.TestCase):
|
||||||
|
"""Segfault when using QTextBlock::setUserData due to missing ownership transfer"""
|
||||||
|
def testIt(self):
|
||||||
|
td = QTextDocument()
|
||||||
|
tc = QTextCursor(td)
|
||||||
|
tc.insertText("Hello world")
|
||||||
|
heyHo = "hey ho!"
|
||||||
|
tc.block().setUserData(MyData(heyHo))
|
||||||
|
self.assertEqual(type(tc.block().userData()), MyData)
|
||||||
|
self.assertEqual(tc.block().userData().getMyNiceData(), heyHo)
|
||||||
|
|
||||||
|
del tc
|
||||||
|
tc = QTextCursor(td)
|
||||||
|
blk = tc.block()
|
||||||
|
self.assertEqual(type(blk.userData()), MyData)
|
||||||
|
self.assertEqual(blk.userData().getMyNiceData(), heyHo)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue