GTK2 + SDL2 (partial fail)
- From: Gabriele Greco <gabriele greco darts it>
- To: "A list for developers using the SDL library. (includes SDL-announce)" <sdl lists libsdl org>, gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: GTK2 + SDL2 (partial fail)
- Date: Thu, 13 Dec 2012 17:06:15 +0100
I've a SDL that on linux uses a gtk2 file chooser, I've just migrated it to
SDL2 and I'm finding a strange problem connected with the initialization
order of the two libraries:
SDL_Init -> gtk_init -> OK
gtk_init -> SDL_Init -> CRASH
Here is a simple program that trigger this behaviour:
#include <gtk/gtk.h>
#include "SDL.h"
int main(int argc, char *argv[]) {
// swap SDL_Init and gtk_init to make it work
gtk_init(&argc, &argv);
if (SDL_Init(SDL_INIT_VIDEO ) < 0) return -1;
GtkWidget *dialog = gtk_file_chooser_dialog_new ("Test", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
gchar *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER
(dialog));
fprintf(stderr, "Selected %s\n", filename);
g_free (filename);
}
}
Compile it with:
gcc -g -o gtksdl gtksdl.c `pkg-config --cflags --libs gtk+-2.0 sdl2`
Here is the GDB stack trace (crashes inside gtk_dialog_run() ):
Program received signal SIGSEGV, Segmentation fault.
__pthread_mutex_lock (mutex=0x656c7974) at pthread_mutex_lock.c:50
50 pthread_mutex_lock.c: No such file or directory.
(gdb) bt
#0 __pthread_mutex_lock (mutex=0x656c7974) at pthread_mutex_lock.c:50
#1 0x00a7b94d in ?? () from /usr/lib/i386-linux-gnu/libX11.so.6
#2 0x00a96b40 in XrmQGetResource () from
/usr/lib/i386-linux-gnu/libX11.so.6
#3 0x00a72003 in XGetDefault () from /usr/lib/i386-linux-gnu/libX11.so.6
#4 0x00c4b64f in ?? () from /usr/lib/i386-linux-gnu/libcairo.so.2
#5 0x00c4d6da in ?? () from /usr/lib/i386-linux-gnu/libcairo.so.2
#6 0x00c1a8a6 in cairo_surface_get_font_options () from
/usr/lib/i386-linux-gnu/libcairo.so.2
#7 0x00bd951c in ?? () from /usr/lib/i386-linux-gnu/libcairo.so.2
#8 0x00bde00a in ?? () from /usr/lib/i386-linux-gnu/libcairo.so.2
#9 0x00bce05e in cairo_show_glyphs () from
/usr/lib/i386-linux-gnu/libcairo.so.2
#10 0x00a51141 in ?? () from /usr/lib/i386-linux-gnu/libpangocairo-1.0.so.0
#11 0x00a51494 in ?? () from /usr/lib/i386-linux-gnu/libpangocairo-1.0.so.0
#12 0x00e8e2fe in pango_renderer_draw_glyphs () from
/usr/lib/i386-linux-gnu/libpango-1.0.so.0
#13 0x00a517f4 in ?? () from /usr/lib/i386-linux-gnu/libpangocairo-1.0.so.0
#14 0x009bf4d3 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#15 0x00e8e2fe in pango_renderer_draw_glyphs () from
/usr/lib/i386-linux-gnu/libpango-1.0.so.0
#16 0x00e8e3f6 in pango_renderer_draw_glyph_item () from
/usr/lib/i386-linux-gnu/libpango-1.0.so.0
#17 0x00e8f027 in pango_renderer_draw_layout_line () from
/usr/lib/i386-linux-gnu/libpango-1.0.so.0
#18 0x00e8f1aa in pango_renderer_draw_layout () from
/usr/lib/i386-linux-gnu/libpango-1.0.so.0
#19 0x009c060b in gdk_draw_layout_with_colors () from
/usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#20 0x009c08b8 in gdk_draw_layout () from
/usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#21 0x012590bd in ?? () from
/usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/engines/libmurrine.so
#22 0x00303317 in gtk_paint_layout () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#23 0x0025ea64 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#24 0x0026b8a2 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#25 0x005a72fd in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#26 0x005a83d2 in g_closure_invoke () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#27 0x005ba70d in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#28 0x005c1ff5 in g_signal_emit_valist () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#29 0x005c2453 in g_signal_emit () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#30 0x003a5413 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#31 0x001deeb8 in gtk_container_propagate_expose () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#32 0x001deee0 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#33 0x0019f4ad in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#34 0x001dd537 in gtk_container_forall () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#35 0x001dd782 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#36 0x0026b8a2 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#37 0x005a72fd in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#38 0x005a83d2 in g_closure_invoke () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#39 0x005ba70d in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#40 0x005c1ff5 in g_signal_emit_valist () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#41 0x005c2453 in g_signal_emit () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#42 0x003a5413 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#43 0x001deeb8 in gtk_container_propagate_expose () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#44 0x001deee0 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#45 0x001a236b in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#46 0x001dd537 in gtk_container_forall () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#47 0x001dd782 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#48 0x0026b8a2 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#49 0x005a72fd in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#50 0x005a83d2 in g_closure_invoke () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#51 0x005ba70d in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#52 0x005c1ff5 in g_signal_emit_valist () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#53 0x005c2453 in g_signal_emit () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#54 0x003a5413 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#55 0x001deeb8 in gtk_container_propagate_expose () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#56 0x001deee0 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#57 0x0019f4ad in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#58 0x001dd537 in gtk_container_forall () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#59 0x001dd782 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#60 0x001acb98 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#61 0x0026b8a2 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#62 0x005a72fd in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#63 0x005a83d2 in g_closure_invoke () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#64 0x005ba70d in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#65 0x005c1ff5 in g_signal_emit_valist () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#66 0x005c2453 in g_signal_emit () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#67 0x003a5413 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#68 0x001deeb8 in gtk_container_propagate_expose () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#69 0x00380ece in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#70 0x0026b8a2 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#71 0x005a72fd in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#72 0x005a8484 in g_closure_invoke () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#73 0x005ba70d in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#74 0x005c1ff5 in g_signal_emit_valist () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#75 0x005c2453 in g_signal_emit () from
/usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#76 0x003a5413 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#77 0x0026a0ff in gtk_main_do_event () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#78 0x009d82bf in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#79 0x009d8262 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#80 0x009d8262 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#81 0x00a0acd3 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#82 0x009d2dc4 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#83 0x009d504f in gdk_window_process_all_updates () from
/usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#84 0x001dd34f in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#85 0x009aff88 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#86 0x0062e850 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#87 0x00630d86 in g_main_context_dispatch () from
/lib/i386-linux-gnu/libglib-2.0.so.0
#88 0x00631125 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#89 0x0063156b in g_main_loop_run () from
/lib/i386-linux-gnu/libglib-2.0.so.0
#90 0x001e0b34 in gtk_dialog_run () from
/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#91 0x0804885e in main (argc=1, argv=0xbffff6a4) at gtksdl.c:16
--
Bye,
Gabry
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]