From 303b51198e0886e183e7c88ab536bd6015220bad Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 28 Sep 2011 22:49:53 +0000 Subject: [PATCH] enforce a single ShowBase --- direct/src/showbase/ShowBase.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 6c7a0976c2..6a638b2b72 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -303,6 +303,10 @@ class ShowBase(DirectObject.DirectObject): # Windows XP supports a 32-bit affinity mask TrueClock.getGlobalPtr().setCpuAffinity(1 << (affinity % 32)) + # Make sure we're not making more than one ShowBase. + if hasattr(__builtin__, 'base'): + raise StandardError, "Attempt to spawn multiple ShowBase instances!" + __builtin__.base = self __builtin__.render2d = self.render2d __builtin__.aspect2d = self.aspect2d