Hi all, I have an animation running like so (toons running around on the screen): Clutter.threads_add_repaint_func(Lang.bind(this, this._frame)).
My extension has a toggle for the animation; when switched to off it calls a function this.initiateStopSequence(). this.initiateStopSequence() simply sets a 'terminate' flag on each toon, nothing else. The function this._frame sees this flag and tells every toon to start playing their "terminate" animation (imaging pressing "stop" and then every toon says "oh no!" and explodes). Only once every toon has finished terminating does this._frame call this.actuallyStop(), which in turn does Clutter.thread_remove_repaint_func to stop the animation. This is fine, *except* that if there is an error thrown in this._frame, all the toons freeze in their current position (because this._frame can't be run any more). However, toggling to 'off' will not remove all the toons from the screen, because it only calls this.initiateStopSequence() rather than this.actuallyStop(). Then the user is stuck with all these toons on their screen that they can't remove. What I want is for this.initiateStopSequence() to be like so: if ( any error has been caught ) { this.actuallyStop(); /* don't worry about the 'terminate' animations, just remove all the toons. */ } else { /* play terminate animations */ /* .. code to set 'terminate' flag */ } But how can I catch any errors thrown by my extension in this.initiateStopSequence? It doesn't call this._frame so I can't really embed a try/catch in it. The only way I can think of is to embed a try/catch into this._frame, and on error call this.actuallyStop() from within this._frame. I'd like to know if there is another way, because it seems like I'm setting up the try/catch within the loop rather than outside the loop. cheers. _______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list