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

Re: [pygame] PATCH Segmentation fault when opening font from file object



I just recognized that I lost the #ifdef TTF_MAJOR_VERSION somewhere. Sorry for that.
This time the attached patch should be correct.

Regards,
Janosch Gräf

--- font.c	2009-06-17 01:18:34.000000000 +0200
+++ font_new.c	2010-08-06 16:42:19.000000000 +0200
@@ -620,9 +622,16 @@ font_init (PyFontObject *self, PyObject
         {
             goto error;
         }
+
+        if (RWopsCheckPython (rw)) {
+            font = TTF_OpenFontIndexRW (rw, 1, fontsize, 0);
+        }
+        else
+        {
         Py_BEGIN_ALLOW_THREADS;
         font = TTF_OpenFontIndexRW (rw, 1, fontsize, 0);
         Py_END_ALLOW_THREADS;
+        }
 #else
         RAISE (PyExc_NotImplementedError,
                "nonstring fonts require SDL_ttf-2.0.6");