UIWebPDFView uses exception, causes debugger to quit

Originator:oliver.drobnik
Number:rdar://11062139 Date Originated:16-Mar-2012 11:32
Status:Duplicate/10237730 Resolved:
Product:iPhone SDK Product Version:5.1
Classification:UI/Usability Reproducible:Always
 
Summary:

When you dismiss a QLPreviewController after viewing a PDF document execution is halted when the debugger is attached. This is a duplicate of rdar://10431759

Steps to Reproduce:

View a PDF with QLPreviewController in Simulator while debugging it. Dismiss the view controller.

Expected Results:

Execution should continue, even with an attached debugger.

Actual Results:

Execution is halted in main.m with the following stack trace.

#0  0x0154acf0 in objc_exception_throw ()
#1  0x01361a78 in +[NSException raise:format:arguments:] ()
#2  0x013619e9 in +[NSException raise:format:] ()
#3  0x00922c94 in -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] ()
#4  0x00922911 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] ()
#5  0x0046a8b0 in -[UIWebPDFView _removeBackgroundImageObserverIfNeeded:] ()

Regression:

We have not tested if this is the same on iOS 4, but it occurs on iOS 5.0 and 5.1

Notes:

If you remove all breakpoints in Xcode then execution is not halted. Simply disabling all does not work. This is an acceptable workaround.

We suspect that UIWebPDFView is using an internal exception handler and simply removes the background image observer in any case. Then without breakpoints or when not debugging the internal try/catch catches this exception and execution continues. 

We suggest to change this code such to not use the C++/Java-style methodology of "try it anyway and catch the exception". Or to modify the debugger to not trip over such internal try/catch tricks.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!