summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-07-20 21:39:51 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-07-20 21:39:51 +0000
commitdc6c58ec4150d933bf7054d55c1d5922ba513228 (patch)
treea33dcf679548a72dd03846eefcf945b659190709 /content
parentcfd56cadf2a2fc98bddecce3f7139f484c92d1a3 (diff)
downloadnetsurf-dc6c58ec4150d933bf7054d55c1d5922ba513228.tar.gz
netsurf-dc6c58ec4150d933bf7054d55c1d5922ba513228.tar.bz2
Fix transition from LOADING to ERROR state after content has been locked for conversion
svn path=/trunk/netsurf/; revision=12614
Diffstat (limited to 'content')
-rw-r--r--content/content.c14
-rw-r--r--content/content_protected.h2
2 files changed, 14 insertions, 2 deletions
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.
diff --git a/content/content_protected.h b/content/content_protected.h
index 4fe9b942a..d113508e4 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -148,6 +148,8 @@ nserror content__clone(const struct content *c, struct content *nc);
void content_set_ready(struct content *c);
void content_set_done(struct content *c);
+void content_set_error(struct content *c);
+
void content_set_status(struct content *c, const char *status_message, ...);
void content_broadcast(struct content *c, content_msg msg,
union content_msg_data data);