launcher: Fix crash

This commit is contained in:
John Cote 2021-06-29 21:58:21 -04:00
parent 599866f837
commit f9c4a31271
2 changed files with 5 additions and 4 deletions

View file

@ -6,6 +6,7 @@ from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from otp.otpbase.PythonUtil import describeException
from direct.showbase import GarbageReport from direct.showbase import GarbageReport
import base64 import base64
import time import time
@ -149,7 +150,7 @@ class TimeManager(DistributedObject.DistributedObject):
self.sendUpdate('setDisconnectReason', [disconnectCode]) self.sendUpdate('setDisconnectReason', [disconnectCode])
def setExceptionInfo(self): def setExceptionInfo(self):
info = PythonUtil.describeException() info = describeException()
self.notify.info('Client exception: %s' % info) self.notify.info('Client exception: %s' % info)
self.sendUpdate('setExceptionInfo', [info]) self.sendUpdate('setExceptionInfo', [info])
self.cr.flush() self.cr.flush()

View file

@ -175,20 +175,20 @@ class LauncherBase(DirectObject):
try: try:
self._runTaskManager() self._runTaskManager()
except SystemExit: except SystemExit:
if hasattr(__builtin__, 'base'): if hasattr(builtins, 'base'):
base.destroy() base.destroy()
self.notify.info('Normal exit.') self.notify.info('Normal exit.')
raise raise
except: except:
self.setPandaErrorCode(12) self.setPandaErrorCode(12)
self.notify.warning('Handling Python exception.') self.notify.warning('Handling Python exception.')
if hasattr(__builtin__, 'base') and getattr(base, 'cr', None): if hasattr(builtins, 'base') and getattr(base, 'cr', None):
if base.cr.timeManager: if base.cr.timeManager:
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
base.cr.timeManager.setDisconnectReason(OTPGlobals.DisconnectPythonError) base.cr.timeManager.setDisconnectReason(OTPGlobals.DisconnectPythonError)
base.cr.timeManager.setExceptionInfo() base.cr.timeManager.setExceptionInfo()
base.cr.sendDisconnect() base.cr.sendDisconnect()
if hasattr(__builtin__, 'base'): if hasattr(builtins, 'base'):
base.destroy() base.destroy()
self.notify.info('Exception exit.\n') self.notify.info('Exception exit.\n')
import traceback import traceback