diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-11-02 00:23:40 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-11-02 00:23:40 +0100 |
commit | c9876c5f3812eb13f2377218d64f98ff9c878ee3 (patch) | |
tree | 9bff49a009e8c3a7dbf1193f54f237026f20b2cb | |
parent | 91b15d827ad0489f62490ee34b2af7dc9aea377e (diff) | |
download | mupdf-c9876c5f3812eb13f2377218d64f98ff9c878ee3.tar.xz |
Fix double free bug when cleaning up the document controller.
-rw-r--r-- | ios/MuPDF.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | ios/main.m | 36 |
2 files changed, 21 insertions, 19 deletions
diff --git a/ios/MuPDF.xcodeproj/project.pbxproj b/ios/MuPDF.xcodeproj/project.pbxproj index 7655aff2..13ddbc82 100644 --- a/ios/MuPDF.xcodeproj/project.pbxproj +++ b/ios/MuPDF.xcodeproj/project.pbxproj @@ -246,7 +246,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ..; INFOPLIST_FILE = Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -273,7 +273,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ..; INFOPLIST_FILE = Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -319,7 +319,6 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen) - (void) dealloc { - [target release]; [titles release]; [pages release]; [super dealloc]; @@ -469,6 +468,7 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen) [self setToolbarItems: [NSArray arrayWithObjects: wrapper, nil]]; [self setView: view]; + [view release]; } - (void) viewWillAppear: (BOOL)animated @@ -504,26 +504,28 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen) [[self navigationController] setToolbarHidden: YES animated: animated]; } -- (void) dealloc +- (void) viewDidUnload { - if (xref) - for (int i = 0; i < pdf_count_pages(xref); i++) - if (pageviews[i]) - [pageviews[i] release]; + for (int i = 0; i < pdf_count_pages(xref); i++) { + if (pageviews[i]) { + [pageviews[i] release]; + pageviews[i] = nil; + } + } - pdf_xref *self_xref = xref; // don't use self after dealloc has finished - dispatch_async(queue, ^{ - printf("close xref\n"); - if (self_xref) - pdf_free_xref(self_xref); - }); + [indicator release]; indicator = nil; + [slider release]; slider = nil; + [wrapper release]; wrapper = nil; + [canvas release]; canvas = nil; +} +- (void) dealloc +{ + if (xref) { + printf("close xref\n"); + pdf_free_xref(xref); + } free(pageviews); - - [indicator release]; - [slider release]; - [wrapper release]; - [canvas release]; [outline release]; [key release]; [super dealloc]; |