MonoTouch.Dialog Elements can be null when search bar used too quickly #94

Open
darbio opened this Issue Jan 9, 2012 · 2 comments

Projects

None yet

1 participant

@darbio
darbio commented Jan 9, 2012

If you have a DialogViewController with a search bar and a user taps between the search bar and the cancel button fast, the Elements node of the Section in the Prepare method on line 2422 of the Elements.cs code is sometimes null so it throws a NullReferenceException.

            public override void FinishSearch ()
    {
        try {
            base.FinishSearch ();
        }
        catch (NullReferenceException ex) {
            // Possible MT bug
        }
    }

From DialogViewcontroller.cs

    public virtual void FinishSearch ()
    {
        if (originalSections == null)
            return;

        Root.Sections = new List<Section> (originalSections);
        originalSections = null;
        originalElements = null;
        searchBar.ResignFirstResponder ();
        ReloadData ();
    }
@darbio
darbio commented Jan 9, 2012

I have reproduced this using a solution and uploaded the project to git at https://github.com/Macropus/Bug-Reports/tree/master/BugReport94

To reproduce the bug, please type in a search term. Click on select, and then immediately Cancel. Then start a new search.

If you do this a few times you will get the afformentioned bug.

This appears to be a threading synchronisation issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment