#288 new
Michael Edgar

CPTabView removeTabViewItem: fails to remove tab [patch included]

Reported by Michael Edgar | July 18th, 2009 @ 02:56 PM

Browser: Safari 4 (untested in others)
Symptom: Calling removeTabViewItem: on a CPTabView causes the associated tab view item to be removed from its list, but does not remove the graphical label (_CPTabViewLabel) associated with it.

Cause: CPTabView uses a CPTabLabelsView class which manages the graphical tabs. It is a delegate to the CPTabView, and receives a tabView:didRemoveTabViewItem: message when the CPTabView removes a tab view item. It calls indexOfTabViewItem: on the CPTabView to determine which of its CPTabLabels to remove from the superview. However, this delegate method is called after the CPTabViewItem has been removed, so the _CPTabLabelsView delegate will always fail to find the index when indexOfTabViewItem: is called. As such, the CPTabLabel is never removed from its superview.

Solution: patch attached, however by moving the delegate call to happen before the removal of the CPTabViewItem from the CPTabView's list, the name "didRemoveTabViewItem" may be better named "willRemoveTabViewItem".

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Cappuccino Web Framework, including AppKit, Foundation, and Objective-J.

Shared Ticket Bins

People watching this ticket