[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    Re: [Kde-perl] PerlQt and threads
From:       Joe Carlson <joe () fruitfly ! org>
Date:       2007-12-10 21:24:23
Message-ID: 1197321863.5736.6.camel () torso ! lbl ! gov
[Download RAW message or body]


I ran into a (similar sounding) problem a while back. The problem was
that Perl garbage collection was making the variable go out of scope.
Once the variable destroyed, no more window. So while I don't know if
this is your problem it possibly could be.

I relied on a global list to push the window variable on to prevent
garbage collection:

    my $newWindow = main::ModuleView();
    $newWindow->show();
    push @main::windowsList, $newWindow;

Even using a circular reference works (for now, anyway), just save the
window variable as one of the module variables. This ought to work until
the garbage collection gets smarter.

joe

On Mon, 2007-12-10 at 15:10 -0700, Roy Souther wrote:
> I am the moderator for the PerlQt list. Your message was held back
> because your sending email address is not in the list. This is to
> protect our members from SPAM. Sorry for the delay.
> 
> I have not used threads in Perl but I would expect it to be logically
> the same as threads in C++. I would expect that the $window variable
> is out of scope and cannot be access by the thread. I would advice you
> to use a call back from the child thread to the parent thread that
> asks the parent thread that does have $window in scope to show the
> window by proxy.
> 
> You will need to lookup how to do callbacks in Perl, I don't have an
> example for that but I am sure it can be done.
> 
> On Tue, 2007-12-04 at 15:52 +0100, Rafał Grzegorz Sławik wrote: 
> > Hello
> > 
> > I have some problem: How can I open new window (from thread)?
> > When I try to do $window->show; I get error "Xlib: unexpected async reply". Is 
> > there any solution to solve this problem?
> > [I have already opened one window.]
> > 
> 
> Royce Souther
> www.SiliconTao.com
> Let Open Source help your business move beyond.
> 
> For security this message is digitally authenticated by GnuPG.
> 
> 
> 
> 
> _______________________________________________
> Kde-perl mailing list
> Kde-perl@kde.org
> https://mail.kde.org/mailman/listinfo/kde-perl

_______________________________________________
Kde-perl mailing list
Kde-perl@kde.org
https://mail.kde.org/mailman/listinfo/kde-perl

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic