Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Remove unused notification observer with non-existent selector #85
I'm a graduate student developing a research prototype plugin for the clang static analyzer that looks for problems with reflection in Objective-C. We ran our prototype on Vienna and found a minor but interesting (from our perspective) issue:
-[FoldersTree initialiseFoldersTree] registers itself as an observer for a bunch of notifications from the default notification center. For one of those notifications ("MA_Notify_AutoCollapseFolder") it specifies a call-back selector that doesn't exist on FoldersTree: (autoCollapseFolder:). This is kind of like a dangling pointer: if anyone were to post a "MA_Notify_AutoCollapseFolder" notification, this would throw an unrecognized selector exception.
Fortunately, it doesn't look like "MA_Notify_AutoCollapseFolder" is ever used, so it is safe to just remove the line that adds the observer. The commit in this pull request does just this.
This commit removes a line that adds a notification center observer for the 'MA_Notify_AutoCollapseFolder' notification. The observer doesn't respond to the specified selector (autoCollapseFolder:) -- there is no instance method with that name on FoldersTree. Since no other code ever posts this notification, it is safe to remove the observer.
We found this issue with a research prototype plugin for the clang static analyzer that looks for problems with reflection.