On Sat, Apr 26, 2008 at 12:34 AM, Drew Smathers <[EMAIL PROTECTED]> wrote:
> I had some utility code which looked something like this:
>
> _defaultLoaded = False
> def defaultFont(size=10):
> global _defaultLoaded
> from pyglet import font
> if not _defaultLoaded:
> fontpath =
> filepath.FilePath(__file__).parent().child('data').child('VeraMono.ttf')
> font.add_file(fontpath.path)
> return font.load('Bitstream Vera Sans Mono', size)
>
> Where I was forgetting of course to set _defaultLoaded to True. This
> eventually results in a segmentation fault on my system (Linux).
> Though I'm unsure of the lower level root cause (which might be a
> waste of time to investigate), I've attached a patch which should
> prevent seg faulting on redundant calls to add_file.
This doesn't segfault on my machine; can you post a stack trace from gdb?
The patch isn't ideal because it potentially keeps files open indefinitely.
Alex.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---