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 various crashes, leaks, and cycles #468

Closed
wants to merge 6 commits into from
Next

Ensure FontHandles on Linux don't outlast the FreeType library refere…

…nce.
  • Loading branch information
jdm committed May 22, 2013
commit a43f92a300ed1f947212195f805aabd731ac7dbb
@@ -53,6 +53,7 @@ pub struct FontHandle {
// if the font is created using FT_Memory_Face.
source: FontSource,
face: FT_Face,
handle: FontContextHandle
}

#[unsafe_destructor]
@@ -81,7 +82,14 @@ impl FontHandleMethods for FontHandle {
// and moving buf into the struct ctor, but cant' move out of
// captured binding.
return match face_result {
Ok(face) => Ok(FontHandle { face: face, source: FontSourceMem(buf) }),
Ok(face) => {
let handle = FontHandle {
face: face,
source: FontSourceMem(buf),
handle: *fctx
};
Ok(handle)
}
Err(()) => Err(())
};

@@ -247,7 +255,11 @@ pub impl<'self> FontHandle {
return Err(());
}
if FontHandle::set_char_size(face, style.pt_size).is_ok() {
Ok(FontHandle { source: FontSourceFile(file), face: face })
Ok(FontHandle {
source: FontSourceFile(file),
face: face,
handle: *fctx
})
} else {
Err(())
}
@@ -268,7 +280,11 @@ pub impl<'self> FontHandle {
return Err(());
}

Ok(FontHandle { source: FontSourceFile(file), face: face })
Ok(FontHandle {
source: FontSourceFile(file),
face: face,
handle: *fctx
})
}

priv fn get_face_rec(&'self self) -> &'self FT_FaceRec {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.