calling main_quit from signal_connect - is it possible/legal ?



Hello All,

suppose I have the following piece of code:

$this->signal_connect
  (
  clicked =>
    sub
      {
      ...
      Gtk2->main_quit;
      ...
      }
  );

where $this is, say, Gtk2::ToggleButton object.

When the button is clicked and Gtk2->main_quit is called, will 
Gtk2->main_quit be executed immediately or the anonymous sub containing
the call to Gtk2->main_quit will be executed to the end and only then main
loop depth will be decreased by one ?

If Gtk2->main_quit is executed immediately, is control passed back to the
anonymous sub containing the call, i.e. will the next statement after
Gtk2->main_quit be executed ?

Is it legal to call Gtk2->main_quit in such a manner ? Will stack integrity
in both "C" and Perl layers be preserved ?

I am not going to call Gtk2->main_quit just for fun, I want to execute a
really lengthy subroutine taking up to, say, 10 seconds. I've noticed that
shorter (a couple of seconds) subroutines work fine, but the long ones
sometimes interfere with GUI behavior - it looks like some events are
either lost or are recognized out of order.

So, overall my idea is to temporarily freeze GUI functionality by calling
Gtk2->main_quit, then to execute the lengthly subroutine, then to revive
the GUI by again calling Gtk2->main.


Thanks,
  Sergei.


      



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]