pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

zathura-pdf-mupdf: Always fz_close_device() before calling fz_drop_device().



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Mon Dec 18 12:09:38 2017 +0100
Changeset:	2167ffbbbeefe5e76f8beb0ab7e25af38aba475c

Modified Files:
	zathura-pdf-mupdf/TODO
	zathura-pdf-mupdf/distinfo
	zathura-pdf-mupdf/patches/patch-render.c

Log Message:
zathura-pdf-mupdf: Always fz_close_device() before calling fz_drop_device().

Before calling fz_drop_device() a corresponding fz_close_device() is needed,
adjust patches/patch-render.c accordingly.

This fixes the:

 warning: dropping unclosed device
 warning: ... repeated <n> times ...

warnings. Unfortunately zathura still SIGSEGV when it is closed but it seems
that happens indipendently of zathura-pdf-mupdf.

Update TODO accordingly.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2167ffbbbeefe5e76f8beb0ab7e25af38aba475c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 zathura-pdf-mupdf/TODO                   | 29 -----------------------------
 zathura-pdf-mupdf/distinfo               |  2 +-
 zathura-pdf-mupdf/patches/patch-render.c | 20 +++++++++++++++-----
 3 files changed, 16 insertions(+), 35 deletions(-)

diffs:
diff --git a/zathura-pdf-mupdf/TODO b/zathura-pdf-mupdf/TODO
index 2e3a618407..a997ef7fb8 100644
--- a/zathura-pdf-mupdf/TODO
+++ b/zathura-pdf-mupdf/TODO
@@ -1,32 +1,3 @@
-- With commit a3f70378, backported for the MuPDF 1.12.0 update, there are:
-
-    warning: dropping unclosed device
-    warning: ... repeated <n> times ...
-
-  ...and then when zathura is closed it crashes with a SIGSEGV.
-  The `bt' - on NetBSD/amd64, 8.99.8 with pkgsrc-current packages - is the following:
-
- #0  0x00007c0085608d80 in ?? ()
- #1  0x00007c0084a02645 in ?? () from /usr/lib/libgcc_s.so.1
- #2  0x00007c0084a10610 in ?? () from /usr/lib/libgcc_s.so.1
- #3  0x00007c0084a10619 in _fini () from /usr/lib/libgcc_s.so.1
- #4  0x00007c0084a10610 in ?? () from /usr/lib/libgcc_s.so.1
- #5  0x00007f7e7ec01d09 in _rtld_call_function_void (obj=<optimized out>, addr=136341669097504) at /usr/src/libexec/ld.elf_so/rtld.h:504
- #6  _rtld_call_initfini_function (obj=<optimized out>, mask=0x7f7fff4c5830, func=136341669097504)
-     at /usr/src/libexec/ld.elf_so/rtld.c:142
- #7  _rtld_call_fini_function (obj=<optimized out>, mask=mask@entry=0x7f7fff4c5830, cur_objgen=10)
-     at /usr/src/libexec/ld.elf_so/rtld.c:157
- #8  0x00007f7e7ec01dc9 in _rtld_call_fini_functions (mask=mask@entry=0x7f7fff4c5830, force=force@entry=1)
-     at /usr/src/libexec/ld.elf_so/rtld.c:203
- #9  0x00007f7e7ec0206a in _rtld_exit () at /usr/src/libexec/ld.elf_so/rtld.c:412
- #10 0x00007c0096100422 in __cxa_finalize (dso=dso@entry=0x0) at /usr/src/lib/libc/stdlib/atexit.c:222
- #11 0x00007c00960fffc3 in exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:60
- #12 0x000000000040eca5 in _start ()
-
-  Investigate and fix these problems if possible. 
-
-    -- leot (2017/12/18)
-
 - Resurrect print/zathura-pdf-mupdf/patches/patch-links.c if still needed
   (probably it is!)
 
diff --git a/zathura-pdf-mupdf/distinfo b/zathura-pdf-mupdf/distinfo
index 02e2d1a1c5..20b303249b 100644
--- a/zathura-pdf-mupdf/distinfo
+++ b/zathura-pdf-mupdf/distinfo
@@ -9,6 +9,6 @@ SHA1 (patch-image.c) = 65fee62ddeddf5329a9eeb868b39f26c9232f759
 SHA1 (patch-index.c) = 96022a5e5c6152e56cecad8f47c4893419536c83
 SHA1 (patch-page.c) = adbe5766d39befdde4aed0a937ff96312921eb2f
 SHA1 (patch-plugin.h) = 1e93cac827843be7a5caf887c5c3381ad16388f4
-SHA1 (patch-render.c) = 81f4bca39e5988b09a27e336ea4377cea0283305
+SHA1 (patch-render.c) = fc14be4e88f9f84383a9e117d15f8f853b14a01b
 SHA1 (patch-select.c) = 5b6505ad998e1980a6cfa4dc0484f0707ea9799a
 SHA1 (patch-utils.c) = 870c37dfd7c359ad1e9891a75e9afc71ac3c36c7
diff --git a/zathura-pdf-mupdf/patches/patch-render.c b/zathura-pdf-mupdf/patches/patch-render.c
index 18b8b435c2..856195fae8 100644
--- a/zathura-pdf-mupdf/patches/patch-render.c
+++ b/zathura-pdf-mupdf/patches/patch-render.c
@@ -1,12 +1,20 @@
 $NetBSD$
 
-Updated for MuPDF 1.12.0
-
-Backport from upstream, commit a3f703788f77b19bb986e14666fe0c47911adddc.
+- Always fz_close_device() before calling fz_drop_device().
+- Updated for MuPDF 1.12.0
+  
+  Backport from upstream, commit a3f703788f77b19bb986e14666fe0c47911adddc.
 
 --- render.c.orig	2017-01-11 21:21:14.000000000 +0000
 +++ render.c
-@@ -37,7 +37,8 @@ pdf_page_render_to_buffer(mupdf_document
+@@ -31,21 +31,25 @@ pdf_page_render_to_buffer(mupdf_document
+     return ZATHURA_ERROR_UNKNOWN;
+   }
+ 
++  fz_close_device(mupdf_page->ctx, device);
+   fz_drop_device(mupdf_page->ctx, device);
+ 
+   fz_irect irect = { .x1 = page_width, .y1 = page_height };
    fz_rect rect = { .x1 = page_width, .y1 = page_height };
  
    fz_colorspace* colorspace = fz_device_bgr(mupdf_document->ctx);
@@ -16,7 +24,9 @@ Backport from upstream, commit a3f703788f77b19bb986e14666fe0c47911adddc.
    fz_clear_pixmap_with_value(mupdf_page->ctx, pixmap, 0xFF);
  
    device = fz_new_draw_device(mupdf_page->ctx, NULL, pixmap);
-@@ -46,6 +47,7 @@ pdf_page_render_to_buffer(mupdf_document
+   fz_run_display_list(mupdf_page->ctx, display_list, device, &fz_identity, &rect, NULL);
++  fz_close_device(mupdf_page->ctx, device);
+   fz_drop_device(mupdf_page->ctx, device);
  
    fz_drop_pixmap(mupdf_page->ctx, pixmap);
    fz_drop_display_list(mupdf_page->ctx, display_list);


Home | Main Index | Thread Index | Old Index