From a0e41a46a3b9b1f94c0449adeda18ff46fdf6a66 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 31 Oct 2015 14:32:22 +0000 Subject: Stop GIF animations when they are no longer in use, instead of waiting until they are destroyed. --- content/content.c | 7 +++++++ content/content_protected.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'content') diff --git a/content/content.c b/content/content.c index be39b15a6..3d06f8e07 100644 --- a/content/content.c +++ b/content/content.c @@ -670,6 +670,9 @@ bool content_add_user(struct content *c, user->next = c->user_list->next; c->user_list->next = user; + if (c->handler->add_user != NULL) + c->handler->add_user(c); + return true; } @@ -699,6 +702,10 @@ void content_remove_user(struct content *c, assert(0); return; } + + if (c->handler->remove_user != NULL) + c->handler->remove_user(c); + next = user->next; user->next = next->next; free(next); diff --git a/content/content_protected.h b/content/content_protected.h index 7311da604..e5ff1cae2 100644 --- a/content/content_protected.h +++ b/content/content_protected.h @@ -82,6 +82,8 @@ struct content_handler { bool (*matches_quirks)(const struct content *c, bool quirks); const char *(*get_encoding)(const struct content *c, enum content_encoding_type op); content_type (*type)(void); + void (*add_user)(struct content *c); + void (*remove_user)(struct content *c); /** handler dependant content sensitive internal data interface. */ void * (*get_internal)(const struct content *c, void *context); -- cgit v1.2.3