Skip to content

Fix mutation of global state 'InvalidRect64'/'InvalidRectD' by 'GetBounds' variants.#11

Merged
micycle1 merged 1 commit intomicycle1:masterfrom
ClaasJG:master
Oct 22, 2023
Merged

Fix mutation of global state 'InvalidRect64'/'InvalidRectD' by 'GetBounds' variants.#11
micycle1 merged 1 commit intomicycle1:masterfrom
ClaasJG:master

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
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