[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] PyQt4: PyObject in SIGNAL
From: Giovanni Bajo <rasky () develer ! com>
Date: 2006-12-03 23:55:20
Message-ID: 457363E8.8090808 () develer ! com
[Download RAW message or body]
Phil Thompson wrote:
>> But this still does not answer my question: what does "PyObject" means in
>> the signature of a signal?
>
> This was my original email:
> http://mats.imk.fraunhofer.de/pipermail/pykde/2006-February/012358.html
In this mail, you said that SIGNAL("foo(PyObject*)") and SIGNAL("foo") are the
same. In my application, the latter does work, but the former was causing a
random crash in the code (the object that arrived in the slot was "wrong", it
had a different id() than the object that was being emitted, and basically
caused a core dump as soon as you accessed it somehow).
I guess there is a bug somewhere. Do you need a repro recipe?
> Also, PyQt doesn't do anything special with the reference counts of PyObject *
> arguments, so you have to make sure that the objects stay alive until all the
> slots in other threads have been run.
In the crash experimented above, there were no threads involved. There was a
QProcess, but I don't think that changes things much.
> It might be possible to wrap a PyObject * in a C++ class that can be passed to
> qRegisterMetaType() and that handles the reference count. I think that would
> mean that you could forget the signal arguments after calling emit(). I need
> to think about that a bit more.
I think something along these lines would be great.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic