title: Glib's hashtable has size 0 after insertion
body: <p>I notice that calling the <code>g_hash_table_insert</code> on a globally defined hashtable results in no insertion in the hashtable:</p>
  <pre class="lang-c prettyprint-override"><code>#define _GNU_SOURCE
  #include &lt;glib.h&gt;
  #include &lt;stdio.h&gt;
  GHashTable* ht;
  void f(void *p)
  {
    g_hash_table_insert(ht,&quot;A&quot;,p );
    g_hash_table_insert(ht,&quot;b&quot;,p );
    g_hash_table_insert(ht,&quot;c&quot;,p );
  
  }
  int main()
  {
    GHashTable* ht=g_hash_table_new(g_str_hash, g_str_equal);
    int i = 3;
    f(&amp;i);
    printf(&quot;=&gt; %d \n&quot;, g_hash_table_size(ht));
    return 0;
  }
  </code></pre>
  <p>The output is:</p>
  <pre><code>(process:23035): GLib-CRITICAL **: 22:04:13.945: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
  
  (process:23035): GLib-CRITICAL **: 22:04:13.945: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
  
  (process:23035): GLib-CRITICAL **: 22:04:13.946: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
  =&gt; 0
  </code></pre>
  <p>How should I avoid this problem and what are the failed assertions telling? How can the hashtable == NULL after being defined?</p>
  <p>I compiled the program with</p>
  <pre><code>gcc -O0 `pkg-config --cflags --libs glib-2.0` -g -Wall -Wextra -std=c11 -pedantic -o /tmp/a a.c
  </code></pre>