Bug 20572 - GetCaretRectForPosition no needs null check
Summary: GetCaretRectForPosition no needs null check
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: master
Hardware: All All
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-06-13 01:55 UTC by peter
Modified: 2014-08-05 15:00 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

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:

Description peter 2014-06-13 01:55:52 UTC
Default implementation of GetCaretRectForPosition prevents seeking with magnifier.

Works without null check.

		public virtual RectangleF GetCaretRectForPosition (UITextPosition position)
			UIApplication.EnsureUIThread ();

			RectangleF result;
			if (this.IsDirectBinding) {
				Messaging.RectangleF_objc_msgSend_stret_IntPtr (out result, base.Handle, Selector.GetHandle ("caretRectForPosition:"), position == null ? IntPtr.Zero : position.Handle);
			else {
				Messaging.RectangleF_objc_msgSendSuper_stret_IntPtr (out result, base.SuperHandle, Selector.GetHandle ("caretRectForPosition:"), position == null ? IntPtr.Zero : position.Handle);
			return result;

Comment 1 Sebastien Pouliot 2014-06-13 10:16:20 UTC
Fixed in master / 78356c33084da8dbeb29521865683bcb605a07fc

QA: unit test added in the same revision
Comment 2 Ram Chandra 2014-08-05 14:34:36 UTC
I have checked this issue on following builds:

Mac OS X 10.8.4
Xamarin Studio: 5.3 (build 412)
=== Build Information ===
Release ID: 503000412
Git revision: 77e042831804079a649ee83092ed36c7c10773a2
Build date: 2014-08-01 06:32:22-04
Xamarin addins: 57e379e6a9454a1c0d97aa3f770e7ae7cc16c522

When I check the definition of "GetCaretRectForPosition" method of "UITextView" class in assembly browser. I observed that now we are checking "position != null" instead of "position == null".

Screencast: http://www.screencast.com/t/faBYQ5yo

Please let me know if this is enough to verify this issue?
Comment 3 Sebastien Pouliot 2014-08-05 15:00:27 UTC
> QA: unit test added in the same revision

There's no need to verify bug fixes when unit tests were added