Skip to content

Commit

Permalink
Fixes KVO observer leak in FBLoginView
Browse files Browse the repository at this point in the history
Summary:
FBLoginView was registering for KVO observation twice on any active
session that became active at the time that the FBLoginView first fetched
the session. The fix moves the current active-session wire-up before
the global observation for active session.

Test Plan: Ran tests, ran hello facebook sample

Reviewers: clang, gregschechte

Reviewed By: clang

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D540267

Task ID: 1235919
  • Loading branch information
Jason Clark committed Aug 6, 2012
1 parent 5bcbff6 commit 926ecaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions scripts/build_distribution.sh
Expand Up @@ -69,6 +69,8 @@ mkdir -p $FB_SDK_BUILD_PACKAGE_DOCS
|| die "Could not copy $$FB_SDK_FRAMEWORK_DOCS/docset/Contents"
\cp $FB_SDK_ROOT/README $FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK \
|| die "Could not copy README"
\cp $FB_SDK_ROOT/LICENSE $FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK \
|| die "Could not copy LICENSE"

# -----------------------------------------------------------------------------
# Fixup projects to point to the SDK framework
Expand Down
5 changes: 3 additions & 2 deletions src/FBLoginView.m
Expand Up @@ -133,6 +133,9 @@ - (void)initialize {
[FBSession openActiveSessionWithPermissions:self.permissions
allowLoginUI:NO
completionHandler:nil];

// wire-up the current session to the login view, before adding global session-change handlers
[self wireViewForSession:FBSession.activeSession];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleActiveSessionSetNotifications:)
Expand All @@ -144,8 +147,6 @@ - (void)initialize {
name:FBSessionDidUnsetActiveSessionNotification
object:nil];

[self wireViewForSession:FBSession.activeSession];

// setup button
self.button = [UIButton buttonWithType:UIButtonTypeCustom];
[self.button addTarget:self
Expand Down

0 comments on commit 926ecaa

Please sign in to comment.