Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-06-17 20:34:03 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-06-17 20:54:20 (GMT)
commit531a572b9fcf201c2f30e889352a09742fded9be (patch)
treece3059a2a0f394dd930214ec1afab8c9743f130b
parent6fce534dc9da0b2f2cc28fd1cb6e92dd0d911a2d (diff)
Avoid crash on activity close
This is a ugly hack, but works. If we found a better option, should replace it. Try to quit pygame at activity shutdown, instead of doing gtk.main_quit() when pygame ends. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rwxr-xr-xactivity.py5
-rw-r--r--olpcgames/canvas.py2
2 files changed, 6 insertions, 1 deletions
diff --git a/activity.py b/activity.py
index 127e73f..68d73d3 100755
--- a/activity.py
+++ b/activity.py
@@ -92,8 +92,13 @@ class MazeActivity(olpcgames.PyGameActivity):
self.set_toolbar_box(toolbar_box)
toolbar_box.show_all()
+ self.connect("destroy", self.__stop_pygame)
+
return toolbar_box
+ def __stop_pygame(self, widget):
+ pygame.quit()
+
def _easier_button_cb(self, button):
pygame.event.post(olpcgames.eventwrap.Event(
pygame.USEREVENT, action='easier_button'))
diff --git a/olpcgames/canvas.py b/olpcgames/canvas.py
index 9f9983c..4d93343 100644
--- a/olpcgames/canvas.py
+++ b/olpcgames/canvas.py
@@ -136,7 +136,7 @@ class PygameCanvas(gtk.Layout):
eventwrap.clear()
finally:
log.info( 'Main function finished, calling main_quit' )
- gtk.main_quit()
+ # gtk.main_quit()
source_object_id = None
def view_source(self):