multithreading gtk
Hello!
I''m writing multithreding network game on gtk2 and got this problem:
Xlib: unexpected async reply (sequence 0x26ac)!
I don''t know yet how to solve this. I found that it occurs when I try to write to textbuffer from another thread (network receiving thread). I have to kill app then.
I already tried using gdk_threads_enter/leave(). It didn''t help. Then I noticed that need to call first g_thread_init(NULL) and gdk_threads_init() but segmentation fault occurse even if I link with libgthreads
I try to find a solution, but if anyone knows solution I''d be very pleased
The problem actually is not there if I remove these lines:
Those just scroll text-view down to view text that was appended at end of text-buffer. Is there other ways or automatic ways to scroll down?
GtkAdjustment *vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll_view));gtk_adjustment_set_value(vadj, vadj->upper); // <-- This caused async error}
Those just scroll text-view down to view text that was appended at end of text-buffer. Is there other ways or automatic ways to scroll down?
Hi, hope someone hears
Here's the simples gtk app possible with thread safety:
Then I compile it:
And I'm getting Segmentation fault as soon as I run it! What am I doing wrong?
[edited by - stefu on October 20, 2002 4:00:14 PM]
Here's the simples gtk app possible with thread safety:
#include <gtk/gtk.h>int main (int argc, char *argv[]){ GtkWidget *window; g_thread_init (NULL); gdk_threads_init(); gtk_init (&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_show(window); gdk_threads_enter(); gtk_main(); gdk_threads_leave(); return 0;}
Then I compile it:
g++ gtest.cpp -o gtest `pkg-config --libs gtk+-2.0` `pkg-config --cflags gtk+-2.0` -lgthread
And I'm getting Segmentation fault as soon as I run it! What am I doing wrong?
[edited by - stefu on October 20, 2002 4:00:14 PM]
I wasso stupid
I had to link with -lgthread-2.0 instead of lgthread of course
I had to link with -lgthread-2.0 instead of lgthread of course
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement