I'm writing a minimal web browser using Cocoa. I've been struggling in my attempt to create an address bar ( basically an NSComboBox in which the drop down contains previously visited URLS ).
The main issue is that the backForwardList attribute of my WebView object is updated at unpredictable times. For instance, if I select a url from the drop down ( the datasource for which is the backForwardList ), then initiate a load request, by the time the dropdown updates the selected item, the backForwardList has been changed and the index of the selectedItem is out of date, so the incorrect address is displayed. What is a good line of attack for dealing with timing issues like this?