summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-01-21 15:25:20 +0300
committerStefano Karapetsas <[email protected]>2015-01-22 09:04:53 +0100
commite2f5dc440589e1c29e5ceae59ea785ff0e512dc7 (patch)
tree961fdb0890d70982548f82047adcbaab91a7f003 /backend
parent11f582cafc8abca5990135a0fe786a4bfe6f7a2a (diff)
downloadatril-e2f5dc440589e1c29e5ceae59ea785ff0e512dc7.tar.bz2
atril-e2f5dc440589e1c29e5ceae59ea785ff0e512dc7.tar.xz
fix careless hack: don't do double-free, avoid weird crashes
because backends manager frees that var already. actually, adding ev_backends_manager_get_backends_dir to the public API was still careless. backends manager and epub document jobs seem to be in the different threads, and there's no mutex seen anywhere around. luckily, what we have here is just a reading of a variable that has been assigned only once (in backends_dir function), so it's not as catastrophic as it would be if it was e.g. concurrent writing without a mutex. Closes https://github.com/mate-desktop/atril/pull/124
Diffstat (limited to 'backend')
-rw-r--r--backend/epub/epub-document.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c
index ffdce89e..c8354d2d 100644
--- a/backend/epub/epub-document.c
+++ b/backend/epub/epub-document.c
@@ -1641,7 +1641,7 @@ static void
epub_document_add_mathJax(gchar* containeruri,gchar* documentdir)
{
gchar *containerfilename= g_filename_from_uri(containeruri,NULL,NULL);
- gchar *backenddir = ev_backends_manager_get_backends_dir();
+ const gchar *backenddir = ev_backends_manager_get_backends_dir();
GString *mathjaxdir = g_string_new(backenddir);
g_string_append_printf(mathjaxdir,"/epub/MathJax");
@@ -1675,7 +1675,6 @@ epub_document_add_mathJax(gchar* containeruri,gchar* documentdir)
item = item->next;
}
xml_free_doc();
- g_free(backenddir);
g_free(mathjaxref);
g_free(containerfilename);
g_free(nodedata);