From dc6c58ec4150d933bf7054d55c1d5922ba513228 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 20 Jul 2011 21:39:51 +0000 Subject: Fix transition from LOADING to ERROR state after content has been locked for conversion svn path=/trunk/netsurf/; revision=12614 --- content/content.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'content/content.c') diff --git a/content/content.c b/content/content.c index ed5202009..f792e794a 100644 --- a/content/content.c +++ b/content/content.c @@ -280,8 +280,7 @@ void content_convert(struct content *c) if (c->handler->data_complete != NULL) { c->locked = true; if (c->handler->data_complete(c) == false) { - c->locked = false; - c->status = CONTENT_STATUS_ERROR; + content_set_error(c); } /* Conversion to the READY state will unlock the content */ } else { @@ -322,6 +321,17 @@ void content_set_done(struct content *c) content_broadcast(c, CONTENT_MSG_DONE, msg_data); } +/** + * Put a content in status CONTENT_STATUS_ERROR and unlock the content. + * + * \note We expect the caller to broadcast an error report if needed. + */ + +void content_set_error(struct content *c) +{ + c->locked = false; + c->status = CONTENT_STATUS_ERROR; +} /** * Reformat to new size. -- cgit v1.2.3