Re: drawing area won't refresh on X11 unless touched, app ismultithreaded, gtk 2.0



I created a new thread for gtk_main using pthreads so that I could do
the
active drawing on the drawing area in the remainder of the normal c main
function. All I then do is this:

I presume you read the threading FAQs and docs on using GTK (and GDK)
with threads?

No.

If you initialized the threading system properly and use
the enter and leave critical sections for all GTK and GDK calls, then
threading will work just fine and the GUI will update normally.  Sounds
like you haven't done this.

I don't currently have any critical sections. The documentation says that
g_thread_init() makes glib thread aware, it would seem to talk about thread
safety, which I don't really care about right now since I don't think I need
mutual exclusion.

But in any case I just added g_thread_init();

but before it even gets to the threading of gtk_main it barfs on line 151 of
test.c which is just:

gtk_widget_show(window);

here is the backtrace:

#0  0x00000000 in ?? ()
#1  0x286722a0 in g_thread_self () from /usr/local/lib/libglib-2.0.so.400
#2  0x28671669 in g_static_private_set ()
   from /usr/local/lib/libglib-2.0.so.400
#3  0x2863049a in g_module_open () from /usr/local/lib/libgmodule-2.0.so.400
#4  0x285cd91c in pango_module_load () from
/usr/X11R6/lib/libpango-1.0.so.399
#5  0x2861def9 in g_type_module_use ()
   from /usr/local/lib/libgobject-2.0.so.400
#6  0x285cdbab in pango_engine_pair_get_engine ()
   from /usr/X11R6/lib/libpango-1.0.so.399
#7  0x285ce57a in append_engines () from /usr/X11R6/lib/libpango-1.0.so.399
#8  0x285ce610 in pango_map_get_engines ()
   from /usr/X11R6/lib/libpango-1.0.so.399
#9  0x285d1cad in get_engines () from /usr/X11R6/lib/libpango-1.0.so.399
#10 0x285d1e12 in get_shaper_and_font ()
   from /usr/X11R6/lib/libpango-1.0.so.399
#11 0x285d22cd in itemize_state_process_run ()
   from /usr/X11R6/lib/libpango-1.0.so.399
#12 0x285d2578 in pango_itemize_with_base_dir ()
   from /usr/X11R6/lib/libpango-1.0.so.399
#13 0x285da1ea in pango_layout_check_lines ()
   from /usr/X11R6/lib/libpango-1.0.so.399
#14 0x285d844f in pango_layout_get_extents_internal ()
#15 0x285d873f in pango_layout_get_extents ()
   from /usr/X11R6/lib/libpango-1.0.so.399
#16 0x2817c051 in gtk_label_get () from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#17 0x28613723 in g_cclosure_marshal_VOID__BOXED ()
   from /usr/local/lib/libgobject-2.0.so.400
#18 0x285fe3e7 in g_type_class_meta_marshal ()
   from /usr/local/lib/libgobject-2.0.so.400
#19 0x285fe0e9 in g_closure_invoke () from
/usr/local/lib/libgobject-2.0.so.400
#20 0x28612076 in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.400
#21 0x28611815 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.400
#22 0x28611c26 in g_signal_emit_by_name ()
   from /usr/local/lib/libgobject-2.0.so.400
#23 0x281dd991 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#24 0x281ddd18 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#25 0x28295d37 in gtk_widget_size_request ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#26 0x280d1d3b in gtk_button_get_relief ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#27 0x28613723 in g_cclosure_marshal_VOID__BOXED ()
   from /usr/local/lib/libgobject-2.0.so.400
#28 0x285fe3e7 in g_type_class_meta_marshal ()
   from /usr/local/lib/libgobject-2.0.so.400
#29 0x285fe0e9 in g_closure_invoke () from
/usr/local/lib/libgobject-2.0.so.400
#30 0x28612076 in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.400
#31 0x28611815 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.400
#32 0x28611c26 in g_signal_emit_by_name ()
   from /usr/local/lib/libgobject-2.0.so.400
#33 0x281dd991 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#34 0x281ddd18 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#35 0x28295d37 in gtk_widget_size_request ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#36 0x2828db3e in gtk_vbox_new () from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#37 0x28613723 in g_cclosure_marshal_VOID__BOXED ()
   from /usr/local/lib/libgobject-2.0.so.400
#38 0x285fe3e7 in g_type_class_meta_marshal ()
   from /usr/local/lib/libgobject-2.0.so.400
#39 0x285fe0e9 in g_closure_invoke () from
/usr/local/lib/libgobject-2.0.so.400
#40 0x28612076 in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.400
#41 0x28611815 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.400
#42 0x28611c26 in g_signal_emit_by_name ()
   from /usr/local/lib/libgobject-2.0.so.400
#43 0x281dd991 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#44 0x281ddd18 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#45 0x28295d37 in gtk_widget_size_request ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#46 0x282a606c in gtk_window_reshow_with_initial_size ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#47 0x28613723 in g_cclosure_marshal_VOID__BOXED ()
   from /usr/local/lib/libgobject-2.0.so.400
#48 0x285fe3e7 in g_type_class_meta_marshal ()
   from /usr/local/lib/libgobject-2.0.so.400
#49 0x285fe0e9 in g_closure_invoke () from
/usr/local/lib/libgobject-2.0.so.400
#50 0x28612076 in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.400
#51 0x28611815 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.400
#52 0x28611c26 in g_signal_emit_by_name ()
   from /usr/local/lib/libgobject-2.0.so.400
#53 0x281dd991 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#54 0x281ddd18 in gtk_size_group_remove_widget ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#55 0x28295d37 in gtk_widget_size_request ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#56 0x282a7168 in gtk_window_propagate_key_event ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#57 0x282a5761 in gtk_window_reshow_with_initial_size ()
   from /usr/X11R6/lib/libgtk-x11-2.0.so.400
#58 0x28612b99 in g_cclosure_marshal_VOID__VOID ()
   from /usr/local/lib/libgobject-2.0.so.400
#59 0x285fe3e7 in g_type_class_meta_marshal ()
   from /usr/local/lib/libgobject-2.0.so.400
#60 0x285fe0e9 in g_closure_invoke () from
/usr/local/lib/libgobject-2.0.so.400
#61 0x28612076 in signal_emit_unlocked_R ()
   from /usr/local/lib/libgobject-2.0.so.400
#62 0x28611815 in g_signal_emit_valist ()
   from /usr/local/lib/libgobject-2.0.so.400
#63 0x28611ab4 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.400
#64 0x28294a3a in gtk_widget_show () from
/usr/X11R6/lib/libgtk-x11-2.0.so.400
#65 0x080493ae in main (argc=1, argv=0xbfbfe988) at test.c:151
#66 0x08048dd2 in _start ()

Lovely huh? Any ideas?

I've read glib thread docs and the FAQ entry but I couldn't find anything
that said about getting windows to refresh, only stuff about thread safety,
do you know from experience that this is a thread problem that causes my
window not to refresh properly?

Does that backtrace above look familiar? Perhaps I messed up my UNIX system?

trigonometric




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]