After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332933 - gimp-edit-copy-visible should work from updated projection
gimp-edit-copy-visible should work from updated projection
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.2.x
Other All
: Normal minor
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-03-01 02:52 UTC by saulgoode
Modified: 2008-01-15 13:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
SIOD file to demo visibility behavior (1.36 KB, text/plain)
2006-03-01 04:41 UTC, saulgoode
Details
XCF image file with two layers (8.7 kilobytes) (8.50 KB, image/x-xcf)
2006-03-01 04:46 UTC, saulgoode
Details

Description saulgoode 2006-03-01 02:52:02 UTC
The plug-in "gimp-edit-copy-visible" should assure that the projection is not
"dirty" (i.e., perform a "gimp-displays-flush") before the copy is performed.
Currently, layers can have their visibility attribute cleared and yet
"gimp-edit-copy-visible" might still include their contents.



Other information:
At a minimum, the PDB documentation should probably suggest performing a
"gimp-displays-flush" before calling "gimp-edit-copy-visible".

On a side note, "gimp-edit-copy-visible" does not seem to put itself into the
UNDO history (although I haven't yet researched this in depth). My apologies if
I am out of line on this, my first use of Bugzilla.
Comment 1 saulgoode 2006-03-01 04:41:48 UTC
Created attachment 60367 [details]
SIOD file to demo visibility behavior

Script is for demonstration purposes only and is simplified to work on an image with two layers. It is not intended to be a useful plug-in.
Comment 2 saulgoode 2006-03-01 04:46:19 UTC
Created attachment 60368 [details]
XCF image file with two layers (8.7 kilobytes)

Image is 320x240 with a Background layer and a Text layer. It is intended to be used with the "test-visibility.scm" plug-in to demonstrate that the function "gimp-edit-copy-visible" assumes that the projection has been updated.
Comment 3 Michael Natterer 2006-03-01 21:48:31 UTC
This should be fixed in the core. All places that read from the projection
must make sure it is up-to-date before doing so.

I'm about to fix this.
Comment 4 Michael Natterer 2006-03-01 21:49:35 UTC
Oh, and copy visible is not in the undo history because it doesn't
change the image.
Comment 5 Michael Natterer 2006-03-02 19:32:26 UTC
Fixed in HEAD. I'm not sure what to do with 2.2, this patch is IMHO too
much of a change for stable. Opinions?

2006-03-02  Michael Natterer  <mitch@gimp.org>

	* app/core/gimppickable.[ch]: added new methods ::get_bytes() and
	::flush()

	* app/core/gimpchannel.c
	* app/core/gimpdrawable.c
	* app/core/gimpimagemap.c
	* app/core/gimpprojection.c: implement ::get_bytes()

	* app/core/gimpprojection.c: implement ::flush() (immediately
	process both the idle renderer's queue and the unflushed update
	areas, to make sure that any reading from the projection will
	re-construct it).

	* app/core/gimp-edit.c
	* app/core/gimpchannel.c
	* app/core/gimpimage-contiguous-region.c
	* app/core/gimpimage-crop.c
	* app/core/gimppalette-import.c
	* app/paint/gimpclone.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpiscissorstool.c
	* tools/pdbgen/pdb/image.pdb: use the pickable interface more
	consistently when reading from any drawable or the projection, and
	call gimp_pickable_flush() before doing so. Fixes bug #332933.

	* app/core/gimpimage-pick-color.c: added comment why the we don't
	call gimp_pickable_flush() here.

	* app/pdb/image_cmds.c
	* libgimp/gimpimage_pdb.c: regenerated.
Comment 6 saulgoode 2006-03-03 00:59:41 UTC
The only reason this situation was grievous to me was that it only occurred in the script itself; i.e., when I replicated the steps using the menus and even when I typed in the commands from the Script-fu console individually, things worked as expected (perhaps the console performs a display flush after each readline?). For my situation, the work-around of manually calling displays-flush before copy-visible would seem satisfactory.




Comment 7 Sven Neumann 2006-03-08 08:07:24 UTC
It should be possibly to find a simpler fix that we can apply in the 2.2 branch.
Comment 8 Michael Natterer 2006-03-08 09:01:40 UTC
I did that fix already. Will commit today.
Comment 9 Michael Natterer 2006-03-08 09:30:13 UTC
Fixed in the 2-2 branch:

2006-03-08  Michael Natterer  <mitch@gimp.org>

	* app/core/gimp-edit.c
	* app/core/gimpchannel.c
	* app/core/gimpimage-contiguous-region.c
	* app/core/gimpimage-crop.c
	* app/core/gimppalette-import.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpiscissorstool.c
	* tools/pdbgen/pdb/image.pdb: flush the projection before reading
	from it. Fixes bug #332933.

	* app/pdb/image_cmds.c: regenerated.