PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 389 - Chained method calls fail: Internal C++ object already deleted
: Chained method calls fail: Internal C++ object already deleted
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: PySide
: HEAD
: All All
: P3 major
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2010-09-28 12:24 EEST by Matti Airas
Modified: 2010-10-13 13:49 EEST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matti Airas 2010-09-28 12:24:14 EEST
From the mailing list:

QWidget().style().standardIcon() call fails with PySide, but works if
result of each call in a chain is assigned to a variable.

---[code]
from PySide.QtGui import QApplication, QWidget, QStyle

app = QApplication([])

q = QWidget()
s = q.style()
print s.standardIcon(QStyle.SP_TitleBarMinButton)

s = QWidget().style()
print s.standardIcon(QStyle.SP_TitleBarMinButton)
---[/code]

---[output]
<PySide.QtGui.QIcon object at 0x02BB7A00>
Traceback (most recent call last):
  File "testmy2.py", line 10, in <module>
    print s.standardIcon(QStyle.SP_TitleBarMinButton)
RuntimeError: Internal C++ object already deleted.
---[/output]

--------------------------------
and:

We have the following

class QReduceBlockData(QTextBlockUserData):

    def __init__(self,n):
        QTextBlockUserData.__init__(self)
        self.message = "Hallo " + str(n)

Somewhere else in our code, we try:

cursor.block().setUserData(QReduceBlockData(4711))
print cursor.block().userData().message

This yields an error: "RuntimeError: Internal C++ object already deleted."

If we introduce a variable like

data = QReduceBlockData(4711)
cursor.block().setUserData(data)
print cursor.block().userData().message

Then it works.
Comment 1 renato filho 2010-09-30 14:45:20 EEST
fixed on commit:

commit 44af04703081f529c433f0fbc5229e9e0d12304f
Author: renatofilho <renato.filho@openbossa.org>
Date:   Thu Sep 30 12:07:20 2010 -0300
Comment 2 renato filho 2010-10-13 13:49:06 EEST
released on PySide 0.4.2