Author: ArcRiley
Date: 2007-07-06 20:33:43 -0400 (Fri, 06 Jul 2007)
New Revision: 391

Modified:
   trunk/pysoy/src/_core-x11/Window.pxi
Log:
no longer segfaults when passed a non-Screen as first argument


Modified: trunk/pysoy/src/_core-x11/Window.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Window.pxi        2007-07-07 00:27:40 UTC (rev 
390)
+++ trunk/pysoy/src/_core-x11/Window.pxi        2007-07-07 00:33:43 UTC (rev 
391)
@@ -32,10 +32,12 @@
     cdef glx.Colormap _colormap
     cdef glx.XSetWindowAttributes _winAttr
     cdef glx.Atom _atom
+    if not isinstance(screen, Screen) :
+      raise TypeError('first argument must be of type soy.Screen')
     self._screen = screen
     _display = glx.DisplayOfScreen(self._screen._screen)
     self._widgets = soy._internals.Children()
-    self._title = title
+    self._title = str(title)
     if background :
       self._background = background
     else :
@@ -82,10 +84,11 @@
     _windows.lock()
     _windows.remove(<void *>self)
     _windows.unlock()
-    glx.XUnmapWindow(_display, self._windowID)
-    glx.glXDestroyContext(_display, self._glxContext)
-    glx.XDestroyWindow(_display, self._windowID)
-    _sleep(10) # Let X11 finish before returning to Python
+    if self._windowID :
+      glx.XUnmapWindow(_display, self._windowID)
+      glx.glXDestroyContext(_display, self._glxContext)
+      glx.XDestroyWindow(_display, self._windowID)
+      _sleep(10) # Let X11 finish before returning to Python
 
   cdef void _render(self) :
     cdef int i

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to