Skip to content

Commit

Permalink
Merge pull request #5402 from migueldeicaza/fix-uigesturerecognizer-r…
Browse files Browse the repository at this point in the history
…egression

[UIKit] UIGestureRecognizer's custon OnDispose method needs to queue the actual operation on the main thread
  • Loading branch information
migueldeicaza authored Jan 15, 2019
2 parents 9baec99 + a06b3f2 commit a2c80ed
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/UIKit/UIGestureRecognizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,21 @@ public partial class UIGestureRecognizer {
{
}

// Called by the Dispose() method
// Called by the Dispose() method, because this can run from a finalizer, we need to
// (a) reference the handle, that we will release later, and (b) to remove the targets on the
// UI thread.
void OnDispose ()
{
foreach (var kv in recognizers)
RemoveTarget (kv.Key, kv.Value);
var copyOfRecognizers = recognizers;
var savedHandle = Handle;
recognizers = null;

DangerousRetain (savedHandle);
NSRunLoop.Main.BeginInvokeOnMainThread (() => {
foreach (var kv in copyOfRecognizers)
RemoveTarget (kv.Key, kv.Value);
DangerousRelease (savedHandle);
});
}

//
Expand Down

1 comment on commit a2c80ed

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run, Test run' 🔥

Build succeeded
✅ Packages: xamarin.ios-12.7.0.66.pkg xamarin.mac-5.7.0.66.pkg
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

1 tests failed, 0 tests skipped, 333 tests passed.

Failed tests

  • apitest/Mac Unified: Failed (Test run crashed (exit code: 134).)

Please sign in to comment.