Commit dfb95c80 authored by Jürg Billeter's avatar Jürg Billeter
Browse files

codegen: Do not use deprecated functions for lock statements

Fixes bug 662810.
parent 14f857a6
......@@ -462,13 +462,16 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
gvalue_type = (Struct) glib_ns.scope.lookup ("Value");
gvariant_type = (Class) glib_ns.scope.lookup ("Variant");
gsource_type = (Class) glib_ns.scope.lookup ("Source");
mutex_type = (Struct) glib_ns.scope.lookup ("StaticRecMutex");
if (context.require_glib_version (2, 32)) {
gmutex_type = (Struct) glib_ns.scope.lookup ("Mutex");
grecmutex_type = (Struct) glib_ns.scope.lookup ("RecMutex");
grwlock_type = (Struct) glib_ns.scope.lookup ("RWLock");
gcond_type = (Struct) glib_ns.scope.lookup ("Cond");
mutex_type = grecmutex_type;
} else {
mutex_type = (Struct) glib_ns.scope.lookup ("StaticRecMutex");
}
type_module_type = (TypeSymbol) glib_ns.scope.lookup ("TypeModule");
......@@ -871,8 +874,15 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
pop_context ();
if (finalize_context != null) {
string mutex_clear;
if (context.require_glib_version (2, 32)) {
mutex_clear = "g_rec_mutex_clear";
} else {
mutex_clear = "g_static_rec_mutex_free";
}
push_context (finalize_context);
var fc = new CCodeFunctionCall (new CCodeIdentifier ("g_static_rec_mutex_free"));
var fc = new CCodeFunctionCall (new CCodeIdentifier (mutex_clear));
fc.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, l));
ccode.add_expression (fc);
pop_context ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment