GNOME Bugzilla – Bug 629593
GLib.Critical thrown using lock without a private member.
Last modified: 2010-10-16 08:45:38 UTC
Created attachment 170205 [details] Test bundle When: Class contains all non-private fields but a lock() is done on one the private mutex field is added to the instance but it seems the instance initialiser is not called correctly. Test bundle shows two cases (1) Class contains protected member on which a lock is done - GLib.Critical results (2) Same class but now with a private member and the mutex initialises fine
Class exhibiting the problem: using GLib; public class TestMutex { protected int thing_to_lock_on; public int other_variable; public TestMutex() { other_variable = 0; } public void a_method() { lock(thing_to_lock_on) { other_variable = 1; } } } public static int main(string[] args ) { TestMutex tm = new TestMutex(); tm.a_method(); return 0; }
Class with additional private member that does not have the problem: using GLib; public class TestMutex2 { private int var_to_fix; protected int thing_to_lock_on; public int other_variable; public TestMutex2() { other_variable = 0; } public void a_method() { lock(thing_to_lock_on) { other_variable = 1; } var_to_fix=1; } } public static int main(string[] args ) { TestMutex2 tm = new TestMutex2(); tm.a_method(); return 0; }
commit c99412b26c6777230f446e28bc034b2152644aa2 Author: Jürg Billeter <j@bitron.ch> Date: Sat Oct 16 10:43:19 2010 +0200 codegen: Fix lock statements in classes without private fields Fixes bug 629593.