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

fix: Don't clone Span in _init_tools #6387

Merged
merged 3 commits into from
Oct 7, 2024
Merged

fix: Don't clone Span in _init_tools #6387

merged 3 commits into from
Oct 7, 2024

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Sep 24, 2024

Fixes #6386

image

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label Sep 24, 2024
@TheoMathurin
Copy link
Contributor

Thanks for the lightning fast fix!

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.48%. Comparing base (6480c73) to head (26ff7e5).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6387   +/-   ##
=======================================
  Coverage   88.48%   88.48%           
=======================================
  Files         323      323           
  Lines       68460    68469    +9     
=======================================
+ Hits        60579    60588    +9     
  Misses       7881     7881           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not safe. We clone models because a user provided Model can only be used within a single plot. What likely needs to happen is that instead of cloning and replacing the models on a per-plot basis we have to search the entire model graph and replace shared instances all at once.

@hoxbro
Copy link
Member Author

hoxbro commented Sep 25, 2024

Just to be sure, we still clone the CrosshairTool with tool = type(tool)(**properties). This is to avoid cloning overlay=height in the following. The span in overlay=[height, width] is not cloned.

This is an regression and was only reasonly introduced in #6220.

height = Span(dimension="height")
width = Span(dimension="width")
cht1 = CrosshairTool(overlay=[height, width])
cht2 = CrosshairTool(overlay=height)

@philippjfr
Copy link
Member

Sorry, misread it, this does look correct.

@hoxbro hoxbro changed the title Fix: Don't clone Span in _init_tools fix: Don't clone Span in _init_tools Oct 7, 2024
@hoxbro hoxbro enabled auto-merge (squash) October 7, 2024 09:39
@hoxbro hoxbro merged commit d776362 into main Oct 7, 2024
14 checks passed
@hoxbro hoxbro deleted the fix_crosshair branch October 7, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken shared linked crosshair tool if set on one dimension only
3 participants