bugjar
bugjar copied to clipboard
GUI crashes with freePtr when stepping through code on Windows 8
When ~~playing with~~ testing bugjar on Windows 8 I discovered that the UI component will consistenly crash with the following error on the console.
TclStackFree: incorrect freePtr. Call out of sequence?
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Based on this link, it seems that this error is caused by more than one thread accessing the tk event loop.
My hypothesis is that the Debugger is invoking callbacks such as MainWindow.on_stack and MainWindow.on_line from the non tk event thread.
Below is an attempt to rectify this situation using the python Queue object.
class MainWindow(object):
def __init__(self, root, debugger):
# <snip>------------
self.queue = Queue.Queue()
self.root.after(200, self.debugger_update)
debugger.start()
def debugger_update(self):
try:
while 1:
func_name, args = self.queue.get_nowait()
handler = getattr(self, func_name)
handler(*args)
except Queue.Empty:
pass
self.root.after(100, self.debugger_update)
# <snip>------------
def on_stack(self, stack):
self.queue.put(('_on_stack', (stack,),))
def _on_stack(self, stack):
# <snip>------------
Using the above setup, I have found that I am able to step through the code without encountering the same freePtr issue.