summaryrefslogtreecommitdiff
path: root/platform/ios/Classes/MuPageView.m
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2013-09-24 16:56:08 +0100
committerPaul Gardiner <paul.gardiner@artifex.com>2013-09-24 16:56:08 +0100
commitaa8bf97eb104986fae3245bc675bd50dded01804 (patch)
tree4c2b67e31aacf9ee508b997bc02b5bb9694e0077 /platform/ios/Classes/MuPageView.m
parent32b292944f3a99edaaf40fa00265d0276f8e0346 (diff)
downloadmupdf-aa8bf97eb104986fae3245bc675bd50dded01804.tar.xz
iOS: use ObjC-level ref counting to control lifetime of fz_document
With the latest version if iOS, timing changes were causing crashes during close down of a MuDocumentController. This change isolates us from those changes.
Diffstat (limited to 'platform/ios/Classes/MuPageView.m')
-rw-r--r--platform/ios/Classes/MuPageView.m8
1 files changed, 5 insertions, 3 deletions
diff --git a/platform/ios/Classes/MuPageView.m b/platform/ios/Classes/MuPageView.m
index 53fe79b9..6fa17f54 100644
--- a/platform/ios/Classes/MuPageView.m
+++ b/platform/ios/Classes/MuPageView.m
@@ -113,11 +113,12 @@ static UIImage *renderTile(fz_document *doc, fz_page *page, CGSize screenSize, C
@implementation MuPageView
-- (id) initWithFrame: (CGRect)frame document: (fz_document*)aDoc page: (int)aNumber
+- (id) initWithFrame: (CGRect)frame document: (MuDocRef *)aDoc page: (int)aNumber
{
self = [super initWithFrame: frame];
if (self) {
- doc = aDoc;
+ docRef = [aDoc retain];
+ doc = docRef->doc;
number = aNumber;
cancel = NO;
@@ -152,12 +153,13 @@ static UIImage *renderTile(fz_document *doc, fz_page *page, CGSize screenSize, C
dispatch_async(dispatch_get_main_queue(), ^{ [block_self dealloc]; });
} else {
__block fz_page *block_page = page;
- __block fz_document *block_doc = doc;
+ __block fz_document *block_doc = docRef->doc;
dispatch_async(queue, ^{
if (block_page)
fz_free_page(block_doc, block_page);
block_page = nil;
});
+ [docRef release];
[linkView release];
[hitView release];
[tileView release];