On Tuesday 20 January 2004 8:13 pm, Roberto Alsina wrote: > Hello, > > Ok, this one is pretty hard to explain. I imagine understanding will be > harder still :-) > > First of all: this same code worked with PyQt 3.8 (I think that was the > version), but doesn't with 3.9 or 3.10 > > Here's the story. > > WI want to make a QTextBrowser show images. To do that, I created my own > QMimeSourceFactory which would download the stuff and return it on its > data() method. > > The data has to be returned as a QMimeObject. Or rather, as something > inheriting QMimeObject, like QTextDrag or QImageDrag. > > The problem is, somewhere things go wrong, and QMimeSource.provides is > called instead of QTextDrag's or QImageDrag's. Since that is pure virtual, > the app goes boom. Here's a backtrace:
I think this is a bug in your application. It worked before because SIP was doing the wrong thing with the ownership of objects returned by Python re-implementations of C++ virtual methods. The current version of SIP is still doing the wrong thing - but a different wrong thing which doesn't affect your code. If you read the Qt docs for QMimeSourceFactory.data() it's seems that the returned value must remain valid after the function returns and it's up to the re-implementation of data() to ensure that. In other words, make sure the returned value doesn't get garbage collected by making it an instance object. In earlier versions of SIP the wrong reference count meant that the returned object wasn't garbage collected which avoided the crash but leaked memory. Phil _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
