Re: $w->cb(undef) causes segfaults. (+patch)

[email protected] (Uri Guttman)
Newsgroups perl.loop
Message-ID <[email protected].>
>>>>> "DN" == Damien Neil <[email protected]> writes:

  DN> (Does this mailing list exist?  My mail to [email protected] and
  DN> [email protected] doesn't return.  Perhaps mail on perl.org
  DN> is just slow.)

it exists.

  DN> The following program segfaults after one second (when the watcher
  DN> triggers):

  DN>   use Event;
  DN>   my $w = Event->timer(after => 1, cb => sub {});
  DN>   $w->cb(undef);
  DN>   Event::loop;

so don't do that. it is kinda silly even if it worked. you stop the
watcher and then delete it.

remember, the callback if it is an object and method is going to create
a data loop which can leak. so always shutdown the watcher first to make it
free up the back links and then delete the watcher itself.

uri

-- 
Uri Guttman  ---------  [email protected]  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.