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 952 - segfault with QBuffer.open()
: segfault with QBuffer.open()
Status: CLOSED INVALID
Product: PySide
Classification: Unclassified
Component: QtCore
: 1.0.4
: Macintosh Mac OS
: P5 major
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-08-02 04:17 EEST by Daniel Ashbrook
Modified: 2011-08-23 00:37 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 Daniel Ashbrook 2011-08-02 04:17:50 EEST
The following code segfaults every few times it is run:

from PySide.QtCore import *
from random import random
A = ''.join(str(int(10000*random())) for i in xrange(10000))
buf = QBuffer(QByteArray(A))
buf.open(QIODevice.ReadOnly)

Also on occasion it gives the error "QBuffer::seek: Invalid pos: 0".


I'm on OSX 10.6.8 with Qt 4.7.3 and PySide from
pyside-1.0.4-r1-qt47-py26apple.pkg.
Comment 1 Hugo Parente Lima 2011-08-02 19:53:07 EEST
You need to keep the buffer you are point to valid, i.e. not delete the
QByteArray while reading the buffer, try it:

from PySide.QtCore import *
from random import random
A = QByteArray(''.join(str(int(10000*random())) for i in xrange(10000)))
buf = QBuffer(A)
buf.open(QIODevice.ReadOnly)
Comment 2 Daniel Ashbrook 2011-08-02 20:07:53 EEST
Ah, I see. In that case, shouldn't the QBuffer increase the reference count on
the QByteArray?
Comment 3 Daniel Ashbrook 2011-08-02 20:20:17 EEST
Oops, I see that's Qt behavior and is documented:

"The caller is responsible for ensuring that byteArray remains valid until the
QBuffer is destroyed, or until setBuffer() is called to change the buffer.
QBuffer doesn't take ownership of the QByteArray."
Comment 4 renato filho 2011-08-23 00:37:19 EEST
Release PySide 1.0.6