beeware / beeware/bugjar

GUI crashes with freePtr when stepping through code on Windows 8

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
256
Forks
35
PR merge metrics
No merged PRs in 30d

Description

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](http://grokbase.com/t/python/tkinter-discuss/112922445t/tclstackfree-error), 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.

``` python
class MainWindow(object):
def __init__(self, root, debugger):

# ------------

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)

# ------------

def on_stack(self, stack):
self.queue.put(('_on_stack', (stack,),))

def _on_stack(self, stack):
# ------------
```

Using the above setup, I have found that I am able to step through the code without encountering the same freePtr issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.