I just encountered the same, while using Python. Searching revealed, that other topics seem to exist, e.g. [url]Help on a tenacious bug], but a real solution does not.
I would be fine, to un-Thread it, but how would I go about it?
Currently there is one function, which writes Panda-Things (e.g. insert and remove models), which runs as a Thread. When it would be called directly, it would block, never return and then Panda won’t render anything (The window stays black).
Important code parts:
opencommands=Queue()
class App(ShowBase):
def __init__(self):
ShowBase.__init__(self)
############# handle incomming commands
# Current, Threaded solution:
self.processing=True
command_thread=Thread(target=self.processCommands)
command_thread.daemon=True
command_thread.start()
def processCommands(self):
'''
Only this thread may call functions, that write any kind of data.
'''
while self.processing:
cmd=opencommands.get(True,None)
opencommands.task_done()
cmdID=cmd[0]
args=cmd[1]
self.commandToF[cmdID](args)
app = App()
app.run()
Edit: The error occurs, when models are added using
model=loader.loadModel(modelfile)
#....
placeholder=render.attachNewNode('modelplaceholder')
placeholder.setPos(tx*C.TILESIZE+twidth*0.5*C.TILESIZE,ty*C.TILESIZE+theight*0.5*C.TILESIZE,0)
model.instanceTo(placeholder)
The code is called from aforementioned Thread.