title: Inserting into GLib Tree from different functions
body: <p>I'm not sure if I'm missing something and that might make this question very stupid. But I can't understand why the hell it's failing after trying pretty much every approach one could have.</p>
  
  <p>So, super simple, I have this GLib Tree and I want to insert stuff into it in other functions. Why none of the options presented below work? I can understand the first failing more than the second to be completely honest.</p>
  
  <pre><code>int compare_ints(gconstpointer gpa, gconstpointer gpb){
       int a = *((int*) gpa);
       int b = *((int*) gpb);
       return (a-b);
   }
  
  void test1(GTree* tree){
       int code = 1234;
       gpointer gcp = &amp;code;
       g_tree_insert(tree, gcp, gcp);
       printf("%d\n", (g_tree_lookup(tree, gcp) == NULL)); // Outputs 0 (obviously)
   }
  
   void test2(GTree** tree){
       int code = 1234;
       gpointer gcp = &amp;code;
       g_tree_insert(*tree, gcp, gcp);
       printf("%d\n", (g_tree_lookup(*tree, gcp) == NULL)); // Outputs 0 (obviously)
   }
  
   int main(int argc, char** argv){
       GTree* tree = g_tree_new(compare_ints);
       int code = 1234;
       gpointer gcp = &amp;code;
       test1(tree);
       printf("%d\n", (g_tree_lookup(tree, gcp) == NULL)); // Outputs 1 (Why?)
       test2(&amp;tree);
       printf("%d\n", (g_tree_lookup(tree, gcp) == NULL)); // Outputs 1 (Why?)
  
       return 0;
   }
  </code></pre>
  
  <p>Sorry about it if it's a stupid question, any help at all apreciated :)</p>
  
  <p>Edit: Removed vim line notation</p>