diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-08-25 15:40:23 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-08-25 15:40:23 (GMT) |
commit | 0342a24e2db0a29bf9f7de8f66a2b0ac92387845 (patch) | |
tree | ea14740f543d3018faabdb060b206a6ba74f1d94 | |
parent | daaf211515541417a3e56c860d8dcc3dc801364b (diff) |
Sugar crashing when saving a journal entry upon closing an activity #1123
-rw-r--r-- | src/sugar/activity/activityfactory.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py index d71e7de..40733b8 100644 --- a/src/sugar/activity/activityfactory.py +++ b/src/sugar/activity/activityfactory.py @@ -269,26 +269,9 @@ class ActivityCreationHandler(gobject.GObject): stderr=log_file.fileno()) gobject.child_watch_add(child.pid, - self.__child_watch_cb, + __child_watch_cb, (environment_dir, log_file)) - def __child_watch_cb(self, pid, condition, user_data): - environment_dir, log_file = user_data - if environment_dir is not None: - subprocess.call(['/bin/rm', '-rf', environment_dir]) - try: - log_file.write('Activity died: pid %s condition %s data %s\n' % - (pid, condition, user_data)) - finally: - log_file.close() - - # try to reap zombies in case SIGCHLD has not been set to SIG_IGN - try: - os.waitpid(pid, 0) - except OSError: - # SIGCHLD = SIG_IGN, no zombies - pass - def _no_reply_handler(self, *args): pass @@ -342,3 +325,22 @@ def create_with_object_id(bundle, object_id): """Create a new activity and pass the object id as handle.""" activity_handle = ActivityHandle(object_id=object_id) return ActivityCreationHandler(bundle, activity_handle) + +# FIXME we use standalone method here instead of ActivityCreationHandler's +# member to have workaround code, see #1123 +def __child_watch_cb(pid, condition, user_data): + environment_dir, log_file = user_data + if environment_dir is not None: + subprocess.call(['/bin/rm', '-rf', environment_dir]) + try: + log_file.write('Activity died: pid %s condition %s data %s\n' % + (pid, condition, user_data)) + finally: + log_file.close() + + # try to reap zombies in case SIGCHLD has not been set to SIG_IGN + try: + os.waitpid(pid, 0) + except OSError: + # SIGCHLD = SIG_IGN, no zombies + pass |