Bug 1644 - Unexpected crashes when changing pages and disposing them in a PDF reader iPhone App using UIPageViewController and PageCurl effect
Summary: Unexpected crashes when changing pages and disposing them in a PDF reader iPh...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2011-10-22 12:06 UTC by Emanuele Sabetta
Modified: 2012-01-30 07:29 UTC (History)
2 users (show)

Tags: UIPageViewController, CATiledLayer, CGPDFPage, PDF, TiledLayerDelegate
Is this bug a regression?: ---
Last known good build:


Attachments
simple test case 1, MonoDevelop 2.8 project (8.41 KB, application/x-gzip)
2011-10-22 12:06 UTC, Emanuele Sabetta
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Emanuele Sabetta 2011-10-22 12:06:25 UTC
Created attachment 753 [details]
simple test case 1, MonoDevelop 2.8 project

KEYWORDS: UIPageViewController, CATiledLayer, CGPDFPage, PDF, TiledLayerDelegate

CASE: I've made a simple PDF reader using the new PageCurl effect available in MonoTouch 5.0 and iOS 5.0. I used a UIViewController and many UIPageViewControllers. As a subviews I added a CATiledLayer used to load the CGPDFPage asynchronously.

PROBLEM: Unexpected crashes when changing pages and disposing them  using UIPageViewController. Probably a problem with the Garbage Collector. The only way to solve it is temporally keeping all pages referenced to avoid garbage collection (but this limit the memory, crashing the App with large PDFs).

GUESS: It seems that something is getting GCd too early and killing the application, but I can't find what. I've tried to dispose everything in many ways, but in vain.

HISTORY: I've submitted the project tarball to the Xamarin team, but they weren't able to solve the problem. You can find a discussion of the bug on StackOverflow.com:

http://stackoverflow.com/questions/7847689/strange-crash-when-using-the-new-pagecurl-effect-reading-a-pdf-with-monotouch-an

I've attached the zipped project, but you can also use the project page on github:

https://github.com/Emasoft/IpaziaPDFReader


CRASH LOG

Stacktrace:

  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) <IL 0x00024, 0xffffffff>
  at MonoTouch.Foundation.NSObject/MonoTouch_Disposer.Drain (MonoTouch.Foundation.NSObject) [0x0006a] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:321
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 0xffffffff>
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
  at IpaziaPDFReader.Application.Main (string[]) [0x00000] in /Users/Emanuele/Projects/PDFReader/IpaziaPDFReader/Main.cs:16
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

	0   IpaziaPDFReader                     0x000e1108 mono_handle_native_sigsegv + 408
	1   IpaziaPDFReader                     0x00011e8f mono_sigsegv_signal_handler + 351
	2   libSystem.B.dylib                   0x98ec005b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   libobjc.A.dylib                     0x0368ce4d _objc_rootRelease + 47
	5   ???                                 0x0ce1cbfc 0x0 + 216124412
	6   ???                                 0x1025077c 0x0 + 270862204
	7   ???                                 0x09aa0dae 0x0 + 162139566
	8   IpaziaPDFReader                     0x00011bdf mono_jit_runtime_invoke + 1407
	9   IpaziaPDFReader                     0x0022020a mono_runtime_invoke + 170
	10  IpaziaPDFReader                     0x002ee5f5 monotouch_trampoline + 3381
	11  CoreFoundation                      0x012d8e72 -[NSObject performSelector:withObject:] + 66
	12  Foundation                          0x0184d9ef __NSThreadPerformPerform + 254
	13  CoreFoundation                      0x012ab97f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
	14  CoreFoundation                      0x0120eb73 __CFRunLoopDoSources0 + 243
	15  CoreFoundation                      0x0120e454 __CFRunLoopRun + 1012
	16  CoreFoundation                      0x0120ddb4 CFRunLoopRunSpecific + 212
	17  CoreFoundation                      0x0120dccb CFRunLoopRunInMode + 123
	18  GraphicsServices                    0x04864879 GSEventRunModal + 207
	19  GraphicsServices                    0x0486493e GSEventRun + 114
	20  UIKit                               0x022a6a9b UIApplicationMain + 1175
	21  ???                                 0x0ce1b305 0x0 + 216118021
	22  ???                                 0x0ce19b90 0x0 + 216112016
	23  ???                                 0x0ce19888 0x0 + 216111240
	24  ???                                 0x0ce199de 0x0 + 216111582
	25  IpaziaPDFReader                     0x00011bdf mono_jit_runtime_invoke + 1407
	26  IpaziaPDFReader                     0x0022020a mono_runtime_invoke + 170
	27  IpaziaPDFReader                     0x00222f41 mono_runtime_exec_main + 705
	28  IpaziaPDFReader                     0x00222151 mono_runtime_run_main + 929
	29  IpaziaPDFReader                     0x000ad7cf mono_jit_exec + 239
	30  IpaziaPDFReader                     0x002f420a main + 5194
	31  IpaziaPDFReader                     0x00003435 start + 53

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================