On Tue, Jul 24, 2007 at 10:17:53PM -0400, Daniel Macks wrote:
> On Tue, Jul 24, 2007 at 06:08:31PM -0700, James P. Crutchfield wrote:
> > fink install of wxpython-py24 (v. 2.5.2.8-1003)
> > OS X 10.4.10 on both Intel and PPC
> > 
> > Program:
> > 
> > import wx
> > from time import *
> > 
> > a = wx.PySimpleApp()
> > b = wx.Frame(None)
> > b.Show(True)
> > a.MainLoop()
> > 
> > When run saturares CPU at 100% and produces an endless stream of
> > 
> > (simplewxtest.py:2510): GLib-WARNING **: poll(2) failed due to:  
> > Invalid argument.
> > 
> > ...
> 
> Confirmed on 10.3, so it's not 10.4's weird poll/select mess, nor a
> problem with glib not recognizing 10.4's poll issues.

wxgtk intentionally disregards system poll() on powerpc-darwin and I
think the poll test on intel-darwin may fail. If no poll(), wxgtk
rolls its own emulator and then sets glib to use it (instead of using
glib's own emulation...why?). This wxPoll() emulator uses select(): in
paticular, it calculates the timeval struct for the passed int timeout
and passed it a pointer to that struct.

Problem: poll() and select() have entirely different ways of
indicating "wait forever": poll() does it with a negative timeout,
select() does it with a NULL timeval pointer. A negative value in
timeval is illegal, which is exactly what wxPoll() does when it is
given a negative timeout. Here's a patch, taken from the poll emulator
in glib:

--- wxPythonSrc-2.5.2.8/src/gtk/app.cpp
+++ wxPythonSrc-2.5.2.8/src/gtk/app.cpp~
@@ -310,7 +310,7 @@
     }
 
     fdMax++;
-    int res = select(fdMax, &readfds, &writefds, &exceptfds, &tv_timeout);
+    int res = select(fdMax, &readfds, &writefds, &exceptfds, timeout == -1 ? 
NULL : &tv_timeout);
 
     // translate the results back
     for ( i = 0; i < nfds; i++ )

that solves the problem for me. Note that this looks like a pure
coding bug in wx and is not at all related to or limited to darwin, cf
their attitude implied at:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1756539&group_id=9863

dan

-- 
Daniel Macks
[EMAIL PROTECTED]
http://www.netspace.org/~dmacks


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Fink-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to