Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using image.Image as colors creates issues when copying in reflectx.SetRobust #1394

Open
rcoreilly opened this issue Dec 23, 2024 · 1 comment
Labels
bug Something isn't working correctly confirmed This bug has been confirmed
Milestone

Comments

@rcoreilly
Copy link
Member

Describe the bug

I added this exception in SetRobust, because otherwise the ploteditor changes the underlying color scheme images, making the entire GUI go bonkers.

	// images should not be copied per content: just set the pointer!
	// otherwise the original images (esp colors!) are altered.
	if img, ok := to.(*image.Image); ok {
		if fimg, ok := from.(image.Image); ok {
			*img = fimg
			return nil
		}
	}

In general there is an ambiguity in copying pointers whether it is "deep" or "shallow". We need to figure out a better general-purpose solution to this issue.

This issue also arises in this case because we made the colors.Scheme colors images instead of underlying color.RGBA -- the images are what we use everywhere because it is the most general representation of color, and it saves having to convert the RGBA to an image in 100's of cases across the codebase.

How to reproduce

comment out the above.,

Example code

No response

Relevant output

No response

Platform

macOS

@rcoreilly rcoreilly added the bug Something isn't working correctly label Dec 23, 2024
@github-project-automation github-project-automation bot moved this to Todo in Bugs Dec 23, 2024
rcoreilly added a commit that referenced this issue Dec 23, 2024
@kkoreilly kkoreilly added the confirmed This bug has been confirmed label Dec 23, 2024
@kkoreilly kkoreilly added this to the v0.4 milestone Dec 23, 2024
@rcoreilly
Copy link
Member Author

This bug is happening with the color picker still, even with the above code in reflectx.SetRobust -- there is some additional logic that needs to be updated in color picker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly confirmed This bug has been confirmed
Projects
Status: Todo
Development

No branches or pull requests

2 participants