Skip to content
This repository has been archived by the owner. It is now read-only.

StrokeOptions is meant to be immutable and add JoinStyle and CapStyle. #145

Merged
merged 2 commits into from Feb 20, 2015

Conversation

@andreasgal
Copy link
Contributor

andreasgal commented Feb 20, 2015

In Moz2D StrokeOptions (and pretty much all structures) are meant to be immutable. This also hides some ugly pointer unboxing in rust-azure. Submitting a separate patch for servo.

andreasgal added a commit to andreasgal/servo that referenced this pull request Feb 20, 2015
@jdm

This comment has been minimized.

Copy link

jdm commented on src/azure_hl.rs in 16cca6b Feb 20, 2015

This will dangle if the vector that dash_pattern is sliced from is reallocated or freed. That's scary.

@jdm

This comment has been minimized.

Copy link

jdm commented on src/azure_hl.rs in 16cca6b Feb 20, 2015

If this is &'static [AzFloat] it should be safe to store a pointer to it.

#[allow(non_snake_case)]
pub struct StrokeOptions {
pub line_width: AzFloat,
pub miter_limit: AzFloat,
pub mDashPattern: *mut AzFloat,
pub mDashPattern: *const AzFloat,

This comment has been minimized.

@Ms2ger

Ms2ger Feb 20, 2015

Contributor

I don't know this code, but could we store an &'a [AzFloat] instead? Then we'd have some protection against uafs.

@metajack
Copy link
Contributor

metajack commented Feb 20, 2015

We could store &'a [AzFloat] and that should solve the problem. as_azure_stroke_options() can then do the .as_ptr().

jdm added a commit that referenced this pull request Feb 20, 2015
StrokeOptions is meant to be immutable and add JoinStyle and CapStyle.
@jdm jdm merged commit cd43e53 into servo:master Feb 20, 2015
andreasgal added a commit to andreasgal/servo that referenced this pull request Feb 20, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.