Hi,

I'm using matplotlib with pygtk in a threaded application. I've seen some 
intermittent hangs, that I think arise from a gtk.gdk.threads_enter/leave 
pair missing in matplotlib.

>From the gtk/pygtk documentation, gtk idle functions need to be protected 
by these locks, but in lib/matplotlib/backends/backend_gtk.py, there is an 
idle function:


  def draw_idle(self):
         def idle_draw(*args):
             self.draw()
             self._idle_draw_id = 0
             return False
         if self._idle_draw_id == 0:
             self._idle_draw_id = gobject.idle_add(idle_draw)

That I think should be:

  def draw_idle(self):
         def idle_draw(*args):
             gtk.gdk.threads_enter()
             self.draw()
             self._idle_draw_id = 0
             gtk.gdk.threads_leave()
             return False
         if self._idle_draw_id == 0:
             self._idle_draw_id = gobject.idle_add(idle_draw)


It looks like there are other idle functions added that might need to be 
protected (delf.idle_event) - but those are handled in backend_bases.py, 
and I haven't dug in enough to see how to deal with those.  Perhaps one 
could just document that any idle functions added by the user need to be 
protected?

I'm using matplotlib 1.0.1 with python 2.7.2 on Gentoo linux.

Carl


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to