Re: Queue Draw does not always call expose signal
- From: Chris Vine <chris cvine freeserve co uk>
- To: Simon Jenkins <simonj2 gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Queue Draw does not always call expose signal
- Date: Sun, 1 May 2011 17:16:03 +0100
On Sun, 1 May 2011 11:08:53 +1000
> For anyone else having this problem, I found the following resource
> very useful:
> http://tadeboro.blogspot.com/2009/06/multi-threaded-gtk-applications.html
>
> The solution was simply to do:
> gdk_threads_enter();
> parent->queue_draw();
> gdk_threads_leave();
>
> In hindsight, I would have designed things a little bit differently
> to allow the code to be easily ported to Windows.
>
> Thanks again Chris, you're a real life saver.
>
> Simon
Presumably, you also put gtk_init()/Gtk::Main::init() and
gtk_main()/Gtk::Main::run() within the global lock (if not, you should
do so).
As Gtk::Widget::queue_draw() does not call any libsigc++
methods, this is one of the cases where using the gdk global
lock works well. However, I still think it is usually better and less
error prone to use Glib::Dispatcher than the global lock.
On this, note that if using gtkmm, Tadej Barovsak's first example (the
gdk lock example) needs extra care because libsigc++ is not thread
safe. This normally means ensuring that all calls to libsigc++
methods are within the global lock or within some other external
synchronisation, and avoiding sigc::trackable.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]