[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-perl
Subject: [Kde-perl] Reference counting
From: Ashley Winters <qaqortog () nwlink ! com>
Date: 2002-05-26 3:57:30
[Download RAW message or body]
I've finally given up hopes of doing weird things to object reference-counts.
I will let Perl handle reference-counts and decide when to delete objects. :)
Two exceptions, though. First, any object can be made parent-controlled with a
method call; something like $object->owned (or a better name?). Second, any
constructor called in a void context returns a persistent (owned?) object. I
don't think I would use ->owned much, but I'd definitely use constructors in
void context.
sub foo {
my $self = shift;
my $w = shift;
new Qt::Label('Destroyed when $self deletes me', $self); # void context
my $x = new Qt::Label('Destroyed when $self deletes me', $self)->owned;
my $l = new Qt::Label('Destroyed at the end of &foo', $self);
$self->{label} = new Qt::Label('Destroyed when $self is', $self);
}
It seems that deleting the QApplication before all widgets are gone is a Bad
Thing. Some objects try to use the QApplication after it croaks, which I
thought Qt would prevent... Perhaps it's my fault.
I can't work on signals/slots until I get virtual function return-values to
work, which I can't do till I get rid of MyStack, which might as well be
replaced with a production-quality type-marshalling system, which will take
me a couple days to write. More updates then.
Ashley Winters
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic