[Kde-bindings] QtRuby memleak continued
Richard Dale
rdale at foton.es
Fri Sep 1 11:08:43 UTC 2006
On Thursday 31 August 2006 13:27, Caleb Tennis wrote:
> As a bonus:
>
> The memory leak in the marshall_QString is occurring on a signal/slot
> connected like this:
>
> connect(o1, SIGNAL('sig(QString &)'), o2, SLOT('slt(QString &)') )
>
> The leak goes away when I change both of those to "const QString &".
> Changing them to just "QString" and the leak seems to persist.
Well the code to delete the QString has these rules, which seem a bit
arbitrary:
fromVALUE (ie Ruby to C++):
if(s && m->type().isConst() && m->cleanup())
delete s;
ToVALUE (ie C++ to Ruby):
if(m->cleanup() || m->type().isStack())
delete s;
So I assume in you example 'slt(QString &)' is a C++ slot, and you are
emitting the signal in Ruby? Then the code in fromVALUE would be wrong and
shouldn't have the 'isConst()' test.
-- Richard
More information about the Kde-bindings
mailing list