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

Re: g_threads problem.



On Wed, 2003-05-28 at 10:16, Martin Klaffenboeck wrote:
> Hello,
> 
> I have got a problem.  I get the following error:
> 
> 
> ** (gports:47984): WARNING **: Invalid UTF8 string passed to 
> pango_layout_set_text()

This is unrelated - please read up on UTF-8 at:

 http://developer.gnome.org/dotplan/porting/ar01s10.html#gtk-utf8

> The program 'gports' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadRequest (invalid request code or no such operation)'.
>    (Details: serial 39922 error_code 1 request_code 229 minor_code 0)
>    (Note to programmers: normally, X errors are reported asynchronously;
>     that is, you will receive the error a while after causing it.
>     To debug your program, run it with the --sync command line
>     option to change this behavior. You can then get a meaningful
>     backtrace from your debugger if you break on the gdk_x_error() 
> function.)
> 
> But I think (not really sure) I'm doing everything correct.

[...]

> That should be correct.  In the function update_ports_treestore_run I 
> have at the beginning:
> 
> static GStaticMutex mutex_lock = G_STATIC_MUTEX_INIT;
> 
>    g_static_mutex_lock (&mutex_lock);
> 
> and before every return:
> g_static_mutex_unlock (&mutex_lock);
> 
> That sould work, but that gives mit this trouble.

You can't lock a GTK+ widget with your own lock, as you aren't the only 
person accessing the widget ... GTK+ also needs to access the widget
and doesn't know to aquire your lock.

You'll need to use gtk_threads_enter()/gtk_threads_leave(), as described
at:
 
 http://www.gtk.org/faq/#AEN445

[ One important update - you need to call gdk_threads_init() along with
  g_thread_init() these days ]

Regards,
                                             Owen





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