From 1de6d19ff4e7fdf6d2b68ba8aaa60d1fd4245d7c Mon Sep 17 00:00:00 2001
From: Aleksey Lim <alsroot@member.fsf.org>
Date: Tue, 25 Aug 2009 13:06:25 +0000
Subject: Sugar crashing when saving a journal entry upon closing an activity #1123
---
src/sugar/activity/activityfactory.py | 36 ++++++++++++++++----------------
1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py
index dcd840f..9da029a 100644
a
|
b
|
class ActivityCreationHandler(gobject.GObject): |
276 | 276 | stderr=log_file.fileno()) |
277 | 277 | |
278 | 278 | gobject.child_watch_add(child.pid, |
279 | | self.__child_watch_cb, |
| 279 | __child_watch_cb, |
280 | 280 | (environment_dir, log_file)) |
281 | 281 | |
282 | | def __child_watch_cb(self, pid, condition, user_data): |
283 | | environment_dir, log_file = user_data |
284 | | if environment_dir is not None: |
285 | | subprocess.call(['/bin/rm', '-rf', environment_dir]) |
286 | | try: |
287 | | log_file.write('Activity died: pid %s condition %s data %s\n' % |
288 | | (pid, condition, user_data)) |
289 | | finally: |
290 | | log_file.close() |
291 | | |
292 | | # try to reap zombies in case SIGCHLD has not been set to SIG_IGN |
293 | | try: |
294 | | os.waitpid(pid, 0) |
295 | | except OSError: |
296 | | # SIGCHLD = SIG_IGN, no zombies |
297 | | pass |
298 | | |
299 | 282 | def _no_reply_handler(self, *args): |
300 | 283 | pass |
301 | 284 | |
… |
… |
def create_with_object_id(bundle, object_id): |
349 | 332 | """Create a new activity and pass the object id as handle.""" |
350 | 333 | activity_handle = ActivityHandle(object_id=object_id) |
351 | 334 | return ActivityCreationHandler(bundle, activity_handle) |
| 335 | |
| 336 | def __child_watch_cb(pid, condition, user_data): |
| 337 | environment_dir, log_file = user_data |
| 338 | if environment_dir is not None: |
| 339 | subprocess.call(['/bin/rm', '-rf', environment_dir]) |
| 340 | try: |
| 341 | log_file.write('Activity died: pid %s condition %s data %s\n' % |
| 342 | (pid, condition, user_data)) |
| 343 | finally: |
| 344 | log_file.close() |
| 345 | |
| 346 | # try to reap zombies in case SIGCHLD has not been set to SIG_IGN |
| 347 | try: |
| 348 | os.waitpid(pid, 0) |
| 349 | except OSError: |
| 350 | # SIGCHLD = SIG_IGN, no zombies |
| 351 | pass |