]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix use of memory profiler in multithreaded applications
authorJörn Magens <interflug1@gmx.net>
Fri, 12 Mar 2010 14:50:13 +0000 (15:50 +0100)
committerJürg Billeter <j@bitron.ch>
Fri, 12 Mar 2010 14:50:13 +0000 (15:50 +0100)
Fixes bug 607973.

codegen/valaccodemethodmodule.vala

index f7b30ae476be17ea222cc4ad159a929f4aa0fb3c..10dd7d28975a170f1ecc3435330a05b14483d074 100644 (file)
@@ -755,13 +755,6 @@ internal class Vala.CCodeMethodModule : CCodeStructModule {
                        var main_block = new CCodeBlock ();
 
                        if (context.profile == Profile.GOBJECT) {
-                               if (context.thread) {
-                                       var thread_init_call = new CCodeFunctionCall (new CCodeIdentifier ("g_thread_init"));
-                                       thread_init_call.line = cmain.line;
-                                       thread_init_call.add_argument (new CCodeConstant ("NULL"));
-                                       main_block.add_statement (new CCodeExpressionStatement (thread_init_call));
-                               }
-
                                if (context.mem_profiler) {
                                        var mem_profiler_init_call = new CCodeFunctionCall (new CCodeIdentifier ("g_mem_set_vtable"));
                                        mem_profiler_init_call.line = cmain.line;
@@ -769,6 +762,13 @@ internal class Vala.CCodeMethodModule : CCodeStructModule {
                                        main_block.add_statement (new CCodeExpressionStatement (mem_profiler_init_call));
                                }
 
+                               if (context.thread) {
+                                       var thread_init_call = new CCodeFunctionCall (new CCodeIdentifier ("g_thread_init"));
+                                       thread_init_call.line = cmain.line;
+                                       thread_init_call.add_argument (new CCodeConstant ("NULL"));
+                                       main_block.add_statement (new CCodeExpressionStatement (thread_init_call));
+                               }
+
                                var type_init_call = new CCodeExpressionStatement (new CCodeFunctionCall (new CCodeIdentifier ("g_type_init")));
                                type_init_call.line = cmain.line;
                                main_block.add_statement (type_init_call);