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 mutation of global state 'InvalidRect64'/'InvalidRectD' by 'GetBounds' variants. #11

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

ClaasJG
Copy link
Contributor

@ClaasJG ClaasJG commented Oct 22, 2023

Hi,

Clipper.GetBounds changes the state of InvalidRect64 and InvalidRectD.
Therefor GetBounds accumulates the biggest bounds over the lifetime of the program and does not compute the requested bounds for the requested path.

While this can be worked around by the user (because those fields are mutable and public)
it makes the static utility functions dependent on global state and therefor prohibits the usage in a multi threaded context.

I think the same bug (or at least absolutely annoying and unexpected behaviour) can be found in the original C# implementation. (EDIT: The original implementation implements Rect64 and RectD as struct and therefor as ValueType. Which means this port differs currently in behaviour. )

Have a nice day

-ClaasJG

@micycle1 micycle1 merged commit a72262f into micycle1:master Oct 22, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants