Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit a1c83c6

Browse files
committed
Don't pass an owned string to g_quark_from_static_string()
When called more than once or for a quark that already exists otherwise, we would always leak the string. Instead pass an unowned string to g_quark_from_string().
1 parent 535ed31 commit a1c83c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/quark.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct Quark(glib_sys::GQuark);
1313

1414
impl Quark {
1515
pub fn from_string(s: &str) -> Quark {
16-
unsafe { from_glib(glib_sys::g_quark_from_static_string(s.to_glib_full())) }
16+
unsafe { from_glib(glib_sys::g_quark_from_string(s.to_glib_none().0)) }
1717
}
1818

1919
#[allow(clippy::trivially_copy_pass_by_ref)]

0 commit comments

Comments
 (0)