Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


multithreading gtk

This topic is 5896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites
The problem actually is not there if I remove these lines:

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?

Share this post

Link to post
Share on other sites
Hi, hope someone hears

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);
gtk_init (&argc, &argv);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);


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]

Share this post

Link to post
Share on other sites
Nice to hear you solved it. I haven''t done any Gtk programming so I kept my mouth shut. Hopefully a few others have been paying attention and have learned from your experience. Congratulations.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!