projects
/
claws.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f54e21b
)
Libravatar: remove hooks on failed init
author
Ricardo Mones
<ricardo@mones.org>
Tue, 22 Sep 2015 12:57:17 +0000
(14:57 +0200)
committer
Ricardo Mones
<ricardo@mones.org>
Tue, 22 Sep 2015 12:57:17 +0000
(14:57 +0200)
src/plugins/libravatar/libravatar.c
patch
|
blob
|
history
diff --git
a/src/plugins/libravatar/libravatar.c
b/src/plugins/libravatar/libravatar.c
index f67d5833cbe4f72d77c61ccab68d180a8e587efa..e36829e61c8387939cecbcdb776f1e89956bef53 100644
(file)
--- a/
src/plugins/libravatar/libravatar.c
+++ b/
src/plugins/libravatar/libravatar.c
@@
-347,6
+347,20
@@
static void missing_cache_done()
}
}
}
}
+static void unregister_hooks()
+{
+ if (render_hook_id != -1) {
+ hooks_unregister_hook(AVATAR_IMAGE_RENDER_HOOKLIST,
+ render_hook_id);
+ render_hook_id = -1;
+ }
+ if (update_hook_id != -1) {
+ hooks_unregister_hook(AVATAR_HEADER_UPDATE_HOOKLIST,
+ update_hook_id);
+ update_hook_id = -1;
+ }
+}
+
/**
* Initialize plugin.
*
/**
* Initialize plugin.
*
@@
-372,11
+386,13
@@
gint plugin_init(gchar **error)
libravatar_image_render_hook,
NULL);
if (render_hook_id == -1) {
libravatar_image_render_hook,
NULL);
if (render_hook_id == -1) {
+ unregister_hooks();
*error = g_strdup(_("Failed to register avatar image render hook"));
return -1;
}
/* cache dir */
if (cache_dir_init() == -1) {
*error = g_strdup(_("Failed to register avatar image render hook"));
return -1;
}
/* cache dir */
if (cache_dir_init() == -1) {
+ unregister_hooks();
*error = g_strdup(_("Failed to create avatar image cache directory"));
return -1;
}
*error = g_strdup(_("Failed to create avatar image cache directory"));
return -1;
}
@@
-386,6
+402,7
@@
gint plugin_init(gchar **error)
curl_global_init(CURL_GLOBAL_DEFAULT);
/* missing cache */
if (missing_cache_init() == -1) {
curl_global_init(CURL_GLOBAL_DEFAULT);
/* missing cache */
if (missing_cache_init() == -1) {
+ unregister_hooks();
*error = g_strdup(_("Failed to load missing items cache"));
return -1;
}
*error = g_strdup(_("Failed to load missing items cache"));
return -1;
}
@@
-402,16
+419,7
@@
gint plugin_init(gchar **error)
*/
gboolean plugin_done(void)
{
*/
gboolean plugin_done(void)
{
- if (render_hook_id != -1) {
- hooks_unregister_hook(AVATAR_IMAGE_RENDER_HOOKLIST,
- render_hook_id);
- render_hook_id = -1;
- }
- if (update_hook_id != -1) {
- hooks_unregister_hook(AVATAR_HEADER_UPDATE_HOOKLIST,
- update_hook_id);
- update_hook_id = -1;
- }
+ unregister_hooks();
libravatar_prefs_done();
missing_cache_done();
if (cache_dir != NULL)
libravatar_prefs_done();
missing_cache_done();
if (cache_dir != NULL)