From 396004014ef1f785b6e30cfc077abfcdac67b7a7 Mon Sep 17 00:00:00 2001 From: luhuaei Date: Sun, 22 Dec 2019 18:55:41 +0800 Subject: [PATCH] pdf-viewer: fix segmentation error and update char offset. --- app/pdf-viewer/buffer.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/pdf-viewer/buffer.py b/app/pdf-viewer/buffer.py index 838ce0f..dc8587d 100755 --- a/app/pdf-viewer/buffer.py +++ b/app/pdf-viewer/buffer.py @@ -665,7 +665,7 @@ class PdfViewerWidget(QWidget): return chars_list def get_char_rect_index(self, event): - offset = 20 + offset = 15 ex, ey, page_index = self.get_event_absolute_position(event) if ex and ey and page_index: rect = fitz.Rect(ex, ey, ex + offset, ey + offset) @@ -753,17 +753,11 @@ class PdfViewerWidget(QWidget): page = self.document[page_index] duplicate_rect = [] for annot in self.select_area_annot_cache_dict[page_index]: - if annot.parent is None: - annot.parent = page - if annot.rect in line_rect_list: - duplicate_rect.append(annot.rect) - else: - # Double click after on multi page select, will cause EAF core dumped - # don't anything error output. - try: + if annot.parent: + if annot.rect in line_rect_list: + duplicate_rect.append(annot.rect) + else: page.deleteAnnot(annot) - except: - pass annot_list = [] for rect in line_rect_list: