MiMo42 / MMTabBarView

A Mac OS X tab bar view that works on 10.9+ with Xcode 9.3+. Pull requests welcomed.
http://mimo42.github.com/MMTabBarView/
243 stars 79 forks source link

UI update on the tab bar may be skipped unexpectedly #38

Closed tsekityam closed 8 years ago

tsekityam commented 8 years ago

Steps to reproduce the problem:

  1. Run the Demo App
  2. Check "hide for single tab"
  3. Drag one of the tabs into a new window

What is the expected behavior? The tab bar in the newly created window should be hidden because there is only one tab in that window, and the "hide for single tab" option of that window is checked.

What went wrong? The tab bar is shown, but there is only one tab in it.

Any other comments? I think it is a threading issue:

  1. Thread A calls [MMTabBarView setNeedsUpdate:YES] from - (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)aTabView, which will add a UI update queue to the main thread and set _needsUpdate to YES;
  2. Thread A calls [MMTabBarView setNeedsUpdate:NO] from - (void)update:(BOOL)animate, then the _needsUpdate will be set to NO;
  3. Main thread now execute the UI update queue, however, the _needsUpdate is NO now, and the main thread will think that there is no need to update the UI and skip the UI update queue.

As a result, the "hide for single tab" option is not affecting

tsekityam commented 8 years ago

Fixed in Dev branch