GNOME Bugzilla – Bug 8141
cancelling a plug-in may leave dangling images around
Last modified: 2018-05-24 10:28:10 UTC
Cancelling the warp plugin sometimes leaves the temporary images
created to hold the displacement maps laying around.
------- Additional Comments From email@example.com 2000-12-09 12:29:15 ----
Subject: Re: cancelling warp plugin leaves tmp displacement map images around
From: Sven Neumann <firstname.lastname@example.org>
Date: 09 Dec 2000 18:29:15 +0100
I'm afraid we can not easily do something about this problem with the
current design of plug-ins in the gimp. The plug-in would need to register
a quit function that aborts the running calculation, then cleans up. Since
Gimp gives us only 10 ms before it kills the plug-in after sending quit
through the pipe, it would be very difficult to implement this properly.
I'll set severity of this bug-report to wishlist.
------- Bug moved to this database by email@example.com 2001-01-28 10:50 -------
This bug was previously known as bug 8141 at http://bugs.gnome.org/
Originally filed under the gimp product and general component.
The original reporter (firstname.lastname@example.org) of this bug does not have an account here.
Reassigning to the exporter, email@example.com.
Reassigning to the default owner of the component, firstname.lastname@example.org.
Re-assigning all Gimp bugs to default component owner (Gimp bugs list)
Assinged to current CVS because it's a still unresolved problem.
Changes at the request of Dave Neary on the developer mailing list.
I am changing many of the bugzilla reports that have not specified a target
milestone to Future milestone. Hope that is acceptable.
Now that there's a stack frame of procedure calls in the GIMP core, this could
actually be implemented. GIMP should track the creation of core objects and
remove any unattached items when the procedure finishes (doesn't really matter
whether it was killed or quit by itself).
Is this still reproducable with the current code?
Yes, just reproduced this with current CVS.
Created attachment 67778 [details] [review]
attempt to delete temporary image from quit handler
Just for the fun of it, I tried to delete the temporary image from the quit handler. The quit() function is called, but for some reason the call to gimp_image_delete() doesn't seem to have any effect. The problem is probably that the core never gets the message because the plug-in is killed directly after the quit function is being called.
Created attachment 73452 [details] [review]
give upto 1 second (in 1/10 second intervals) for plug-in to die after GP_QUIT is sent
(Sven: Sorry if this's not the right place to post the patch, but I wrote it for this particular issue.)
Basically the patch increases the time delay to 1 second, while checking every 1/10 seconds if the plug-in has already died and exiting the loop early (and hence not blocking the app if everything is ok). So a plugin will get upto a second before it gets killed, and if it wants to, it can clean up. I applied Sven's patch as well to the warp plug-in and it seems to get enough time to clean up now.
I hope this is not a bad idea.
Mitch explained to me that the app is blocked while waiting and the plug-in can't talk to it at that time. So this idea is borked. Please ignore the last patch.
The idea that was outlined in comment #4 doesn't work. At least not without some additional API. The core currently does not know if an unattached image (an image that doesn't have a display) is just some junk left by a broken script or plug-in or if it is important. We would have to add an API that allowed a plug-in to tell GIMP that it creates a temporary image that should not be kept around when the plug-in exits.
Alternatively we can try to follow the approach from comment #7. That would need a change in the core to do a non-blocking wait for the plug-in to quit.
Cancelling the PDF import plug-in is another way to run into this bug. When opening multiple pages as images, the plug-in first opens the images, then goes through the list of images and creates displays for them. If you cancel the plug-in, the images are still loaded, they just don't have displays created for them. To the user who is not aware of this (and the possibility to delete the dangling images from the "Images" dockable) this appears as a massive memory leak.
*** Bug 690512 has been marked as a duplicate of this bug. ***
We still got a reviewed patch attached here - but the last few comments hint that it didn't work, right?
-- GitLab Migration Automatic Message --
This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/3.