After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 629593 - GLib.Critical thrown using lock without a private member.
GLib.Critical thrown using lock without a private member.
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other All
: Normal critical
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-09-14 00:18 UTC by Daniel Hams
Modified: 2010-10-16 08:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test bundle (494 bytes, application/x-gzip)
2010-09-14 00:18 UTC, Daniel Hams
Details

Description Daniel Hams 2010-09-14 00:18:03 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
Comment 1 Daniel Hams 2010-09-14 00:26:55 UTC
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;
}
Comment 2 Daniel Hams 2010-09-14 00:27:26 UTC
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;
}
Comment 3 Jürg Billeter 2010-10-16 08:45:38 UTC
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.