summaryrefslogtreecommitdiff
path: root/platform/windows/mupdfwinrt/muctx.cpp
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2015-01-21 13:20:36 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2015-01-27 14:05:20 -0800
commit7584edc737ebb5277801a9e6b51eb5531fdf84d2 (patch)
tree957a9d2e3d25ea63f0592fe09f1887f297445c9f /platform/windows/mupdfwinrt/muctx.cpp
parentb4e11b0b493c88e94a205643767e3c744ae17fde (diff)
downloadmupdf-7584edc737ebb5277801a9e6b51eb5531fdf84d2.tar.xz
Fix issue in display list Cache
The commit fc05b51c2b198dcc5553f6de1b8fb0e22e7d28ae cleaned up a few issues in the display list cache but it introduced issues when multiple threads are using the lists. In particular one thread could be using a list at the tail of the cache list, while another thread is adding one to the cache, and removing the entry at the tail. The solution is to make sure the ref count of the list is incremented when someone is using the list and making sure that it gets decremented when they are done with the list.
Diffstat (limited to 'platform/windows/mupdfwinrt/muctx.cpp')
-rw-r--r--platform/windows/mupdfwinrt/muctx.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/platform/windows/mupdfwinrt/muctx.cpp b/platform/windows/mupdfwinrt/muctx.cpp
index fbcb01f3..e51ea403 100644
--- a/platform/windows/mupdfwinrt/muctx.cpp
+++ b/platform/windows/mupdfwinrt/muctx.cpp
@@ -531,6 +531,21 @@ fz_display_list * muctx::CreateDisplayList(int page_num, int *width, int *height
return dlist;
}
+void muctx::ReleaseDisplayLists(void *opdlist, void *opannotlist)
+{
+ fz_display_list *dlist = (fz_display_list*) opdlist;
+ fz_display_list *annotlist = (fz_display_list*) opannotlist;
+
+ if (dlist != NULL)
+ {
+ fz_drop_display_list(mu_ctx, dlist);
+ }
+ if (annotlist != NULL)
+ {
+ fz_drop_display_list(mu_ctx, annotlist);
+ }
+}
+
/* A special version which will create the display list AND get the information
that we need for various text selection tasks */
fz_display_list * muctx::CreateDisplayListText(int page_num, int *width, int *height,