Re: [Gimp-developer] Re: Cancel function and plugins

2006-06-15 Thread Sven Neumann
Hi,

On Thu, 2006-06-08 at 09:36 +0100, Toby Speight wrote:

 Sven Well, in theory it could catch the signal and clean up before it
 Sven exits.
 
 No, SIGKILL can't be caught by a process.

The plug-in receives a QUIT message on the wire before it is being
killed. Probably not trivial to do the right thing in response to that
message, but it could be done.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] Re: Cancel function and plugins

2006-06-08 Thread Toby Speight
0 In article [EMAIL PROTECTED],
0 Sven Neumann URL:mailto:[EMAIL PROTECTED] (Sven) wrote:

Sven On Wed, 2006-06-07 at 17:36 +0100, Toby Speight wrote:

 While we're on this subject - obviously the plug-in process has no
 chance to clear up if it's killed outright,

Sven Well, in theory it could catch the signal and clean up before it
Sven exits.

No, SIGKILL can't be caught by a process.


 so what happens to e.g. undo stack in this case?  Is it all just left
 hanging as it was, or is there some attempt by Gimp to roll-back
 the effect of the plugin?

Sven GIMP tries to establish a sane state. IIRC, it pops the context
Sven the plug-in was running in and makes sure that undo groups are
Sven closed.

Thanks - I didn't find this in the code (perhaps the closing of
undo groups is part of popping the context?).  It certainly seems
better-behaved than when a plug-in crashes (on 2.2, anyway).

I seem to have solved the problem I was having with the GTS library (I
was using gts_delaunay_refine() rather than gts_delaunay_conform(),
and it wasn't happy), so I should be able to make more progress on my
plug-in over the next few weeks (or whenever I have free time).

Thanks for the help on this.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] Re: Cancel function and plugins

2006-06-07 Thread Toby Speight
0 In article [EMAIL PROTECTED],
0 Nathan Summers URL:mailto:[EMAIL PROTECTED] (Nathan) wrote:

Nathan Cancelling a plugin kills it unconditionally.  It's been a
Nathan few months since I looked at that code, but I'm fairly sure
Nathan that there is no way for a plug-in to catch that it's been
Nathan cancelled.

Thanks for the insight; hunting around a bit more, I've found comments
to the effect that cancel signals the plug-in process with SIGKILL
(in a Unix world, which is where I'm comfortable).  So there's nothing
I need to do to have Cancel work as expected, as long as I ensure that
I check all PDB calls and treat failures appropriately?

While we're on this subject - obviously the plug-in process has no
chance to clear up if it's killed outright, so what happens to
e.g. undo stack in this case?  Is it all just left hanging as it was,
or is there some attempt by Gimp to roll-back the effect of the
plugin?  I know, I know - UTSL!  In plug-in.c, I find code in
plug_in_close() that unregisters temporary procedures and closes
dialogs, but that appears to be it.  :-(  Correct?
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Re: Cancel function and plugins

2006-06-07 Thread Sven Neumann
Hi,

On Wed, 2006-06-07 at 17:36 +0100, Toby Speight wrote:

 While we're on this subject - obviously the plug-in process has no
 chance to clear up if it's killed outright,

Well, in theory it could catch the signal and clean up before it exits.

 so what happens to e.g. undo stack in this case?  Is it all just
 left hanging as it was, or is there some attempt by Gimp to roll-back
 the effect of the plugin?

GIMP tries to establish a sane state. IIRC, it pops the context the
plug-in was running in and makes sure that undo groups are closed.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Re: Cancel function and plugins

2006-06-07 Thread Michael Natterer
On Wed, 2006-06-07 at 19:54 +0200, Sven Neumann wrote:
 Hi,
 
 On Wed, 2006-06-07 at 17:36 +0100, Toby Speight wrote:
 
  While we're on this subject - obviously the plug-in process has no
  chance to clear up if it's killed outright,
 
 Well, in theory it could catch the signal and clean up before it exits.
 
  so what happens to e.g. undo stack in this case?  Is it all just
  left hanging as it was, or is there some attempt by Gimp to roll-back
  the effect of the plugin?
 
 GIMP tries to establish a sane state. IIRC, it pops the context the
 plug-in was running in and makes sure that undo groups are closed.

Um, no :( Load plug-ins do that. Unfortunately any other plug-in
can still crash the core by leaving undo groups open. I have some
half-finished code but gave up because the approach was apparently
wrong (it became way too complicated).

ciao,
--mitch

___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer