From 7584edc737ebb5277801a9e6b51eb5531fdf84d2 Mon Sep 17 00:00:00 2001 From: Michael Vrhel Date: Wed, 21 Jan 2015 13:20:36 -0800 Subject: 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. --- platform/windows/mupdfwinrt/muctx.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'platform/windows/mupdfwinrt/muctx.cpp') 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, -- cgit v1.2.3