title: GTK+3 file chooser in a non-GTK application
body: <p>I have a C project (on Linux) which does not use GTK at all, but I would like to use GTK only for some specific tasks like selecting a file (file chooser dialog). So I have no GTK parent window, no gtk main loop, etc, I only want a file chooser dialog, which should block the execution of my program till user selected a file (or cancelled) and I don't use GTK then after that ever. What I've tried:</p>
  
  <p><a href="https://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html" rel="nofollow">https://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html</a></p>
  
  <p>I used the code at "Typical usage", first example. I put gtk_init(&amp;argc, &amp;argv) at the start of my program, and when I need the file chooser, I call a function with code from that example (I use parent as NULL, since there is no parent). The result is a flashing window for a fraction of second, then SIGSEGV. Before that I have this message:</p>
  
  <pre><code>Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
  </code></pre>
  
  <p>I already read questions/answers on this message here at stackoverflow, but crashing the application is a more serious thing for me. I've also tried to put this:</p>
  
  <pre><code>gtk_widget_show_all(dialog);
  </code></pre>
  
  <p>after gtk_file_chooser_dialog_new() which causes no crash, I can select the file, but then I have the SIGSEGV again around gtk_file_chooser_get_filename().</p>
  
  <p>When using gdb, I got this:</p>
  
  <pre><code>Program received signal SIGSEGV, Segmentation fault.
  __GI___pthread_mutex_lock (mutex=0x3c3) at ../nptl/pthread_mutex_lock.c:67
  </code></pre>
  
  <p>Can you help me what mistake I did? I am not familiar with GTK programming too much, so I tried to use examples from the manual, but it does not seem to work. Thanks a lot in advance!</p>