[PyQt] ANN: eric 4.5.1 released
Hi, I just uploaded eric 4.5.1. It is a maintenance release fixing some bugs. It is available via the eric web site. http://eric-ide.python-projects.org/index.html Regards, Detlev -- Detlev Offenbach det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QWidget 'destroyed' signal: possible regression?
On Sun, 26 Feb 2012 16:23:26 +0100, Pierre Raybaut wrote: > Hi Phil, > > I recently found out that a feature succesfully tested with older > versions of PyQt was broken > (http://code.google.com/p/spyderlib/issues/detail?id=951) and at the > same time the Matplotlib developers contacted me for a similar issue > (https://github.com/matplotlib/matplotlib/issues/711). > > To explain our problem, I wrote this test script: > > #- > from PyQt4.QtGui import QApplication, QWidget > from PyQt4.QtCore import Qt > > def print_from_function(): > print "Callback = Function" > > class TestWidget(QWidget): > def __init__(self, parent=None): > QWidget.__init__(self, parent) > self.destroyed.connect(print_from_function) > self.destroyed.connect(self.print_from_method) > self.destroyed.connect(self.print_from_static_method) > self.destroyed.connect(lambda: self.print_from_lambda_function()) > self.setAttribute(Qt.WA_DeleteOnClose) > > def print_from_method(self): > print "Callback = method" > > @staticmethod > def print_from_static_method(self): > print "Callback = static method" > > def print_from_lambda_function(self): > print "Callback = lambda function" > > app = QApplication([]) > widget = TestWidget() > widget.show() > app.exec_() > #- > > The issue with the test script above is that all callbacks connected > to the 'destroyed' signal are triggered except for the callback which > is a method (bound to the object to be destroyed). > > So the question is: is this a regression from PyQt v4.8.5? (or earlier) First off I think that connecting the destroyed() signal to a method of the object being destroyed is a bug. There are no guarantees about the state of the object when the signal is emitted. The change in behaviour was introduced in SIP v4.10.3 released July 2010. As far as I can tell the change was made because I thought it was a good idea rather than in response to a bug report. The intent would have been to eliminate any "C/C++ object has been deleted" exceptions - but, as in this case, the slot may not make any calls that would trigger an exception. With hindsight I think I will back out the change. I dislike the inconsistency in behaviour more than I dislike the buggy application code. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] sip: Member objects and GC
On Fri, 24 Feb 2012 17:13:11 +0100, Jonathan Kleinehellefort wrote: > Hallo, > > I was asked to debug memory corruption problem in some sip-based Python > bindings, and what I found leads me to believe that sip is to blame. > I'll try to explain the problem: > > Let's say you have a C++ class that looks like this: > > struct C { M m; }; > > And then let's assume there is some Python code that accesses m after > its containing c object is no longer referenced by Python, for example: > > C().m > > The Python wrapper for m will then point inside the *deleted* c object, > leading to memory corruption. > > I have a more complete example at > > http://molb.org/~jk/siptest.tar.gz > > First of all, I think this should be considered a bug in sip, since it > easily can result in memory corruption, while there is not even a > warning or even a mention of this problem in the documentation. It > might even be better for sip to refuse generating code for accessing > members. > > What I would like happen in this case is that when the m wrapper is > created, the reference count for the c wrapper would be increased, and a > reference to c is stored in m, so that c can be dereferenced when m is > deleted. > > However, I'm not sure how to achieve this. I looked at the ownership > stuff but I don't think this will help me. So I'm asking for help on > how to fix or work around this problem. Fixed in tonight's snapshot. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt