summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-15 19:05:02 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:59 -0300
commit8f34f94da365825c2d21e02fb10a44d4cefb313b (patch)
tree6056daa2d59e03cc3fc2661b527ad881beec6548
parent7c606aeda23b4469ca924ebb974b1eac397ff0e5 (diff)
Fix bug 675 - "QGraphicsLinearLayout segfault"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml10
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_675.py15
3 files changed, 22 insertions, 4 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 21dc5d3c..b7b28734 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -3083,9 +3083,11 @@
</modify-function>
<modify-function signature="addWidget(QWidget*,QFlags&lt;Qt::WindowType&gt;)">
- <modify-argument index="return">
- <parent index="this" action="add" />
- </modify-argument>
+ <!-- TODO: Add a keeper attribute to reference-count tag to do what this inject code do. -->
+ <inject-code>
+ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME(%1, %2));
+ Shiboken::Object::keepReference((SbkObject*)%PYARG_0, "setWidget(QWidget*)1", %PYARG_1);
+ </inject-code>
</modify-function>
<!-- use glue code -->
@@ -5062,7 +5064,7 @@
</modify-function>
<modify-function signature="setWidget(QWidget*)">
<modify-argument index="1">
- <parent index="this" action="add"/>
+ <reference-count action="set"/>
</modify-argument>
</modify-function>
</object-type>
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index d22c67ea..1c10e5c3 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -39,6 +39,7 @@ PYSIDE_TEST(bug_660.py)
PYSIDE_TEST(bug_662.py)
PYSIDE_TEST(bug_667.py)
PYSIDE_TEST(bug_668.py)
+PYSIDE_TEST(bug_675.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
diff --git a/tests/QtGui/bug_675.py b/tests/QtGui/bug_675.py
new file mode 100644
index 00000000..d490f0f6
--- /dev/null
+++ b/tests/QtGui/bug_675.py
@@ -0,0 +1,15 @@
+from PySide.QtCore import *
+from PySide.QtGui import *
+
+app = QApplication([])
+
+scene = QGraphicsScene()
+
+# don't segfault due to lack of keepReferenceCall
+textEdit = scene.addWidget(QTextEdit())
+
+layout = QGraphicsLinearLayout()
+layout.addItem(textEdit)
+
+view = QGraphicsView(scene)
+view.show()