UI update on the tab bar may be skipped unexpectedly
tsekityam opened this issue · comments
Tse Kit Yam commented
Steps to reproduce the problem:
- Run the Demo App
- Check "hide for single tab"
- 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:
- 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
toYES
; - Thread A calls
[MMTabBarView setNeedsUpdate:NO]
from- (void)update:(BOOL)animate
, then the_needsUpdate
will be set toNO
; - Main thread now execute the UI update queue, however, the
_needsUpdate
isNO
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
Tse Kit Yam commented
Fixed in Dev branch