[Sugar-devel] [PATCH] Infoslicer: Avoid crash when a article is downloaded - SL #2856

Walter Bender walter.bender at gmail.com
Fri May 20 11:33:51 EDT 2011


On Thu, May 19, 2011 at 10:26 AM, Gonzalo Odiard <godiard at sugarlabs.org>wrote:

> ---
>  book.py     |    5 ++++-
>  bookview.py |    1 -
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/book.py b/book.py
> index 681bdba..f28ff99 100644
> --- a/book.py
> +++ b/book.py
> @@ -71,11 +71,14 @@ class Book(gobject.GObject):
>
>         self._article.uid = entry['uid']
>         self._article.article_title = title
> -        self.emit('article-selected', self._article)
> +        gobject.idle_add(self._emit_article_selected)
>
>     article = gobject.property(type=object,
>             getter=get_article, setter=set_article)
>
> +    def _emit_article_selected(self):
> +        self.emit('article-selected', self._article)
> +
>     # save current article
>     def sync_article(self):
>         # stub
> diff --git a/bookview.py b/bookview.py
> index dfbb205..8b049d6 100644
> --- a/bookview.py
> +++ b/bookview.py
> @@ -154,7 +154,6 @@ class BookView(gtk.VBox):
>
>         self.book.props.article = article
>         self.store.append((False, article))
> -        self.tree.set_cursor(len(self.store)-1, self.tree.get_column(1),
> False)
>
>     def _create_cb(self, widget):
>         def find_name(list, prefix, uniq):
> --
> 1.7.4.4
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>

I am not very familiar with treeview, but the "path" in the set_cursor call
seems to be OK (just ran some tests) but maybe it is a race condition of
some sort: pointing to the new last entry in the list before the list knows
it has a new last entry? In any case, simply eliminating the call to
set_cursor seems to be enough to address the crash problem. What is the
first part of the patch trying to accomplish?

-walter

-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110520/fa4a4272/attachment.html>


More information about the Sugar-devel mailing list