Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible memory leak in CLUUserInteractionModule because of connected gesture recognizer #5

Open
Geek-1001 opened this issue Apr 24, 2017 · 0 comments

Comments

@Geek-1001
Copy link
Owner

Description

There is a #warning in CLUUserInteractionModule class in startRecording method

- (void)startRecording {
    if (!self.isRecording) {
        [super startRecording];
        [_gestureRecognizer setObserverDelegate:self];
        #warning If some window will be destroyed how to deattach gesture recognizer from it? Possible memory leak!
        [[[UIApplication sharedApplication] keyWindow] addGestureRecognizer:_gestureRecognizer];
    }
}

We're connecting gesture recognizer to specific window [[UIApplication sharedApplication] keyWindow].

Problems

  • Key window could change during the lifetime of the app.
  • What if current key window is different from current active window (in terms of touch events) at the moment

References

A window is considered the key window when it is currently receiving keyboard and non touch-related events. Whereas touch events are delivered to the window in which the touch occurred, events that don’t have an associated coordinate value are delivered to the key window. Only one window at a time can be key
@Geek-1001 Geek-1001 changed the title Fix possible memory leak in CLUUserInteractionModule because of connected gesture recognizer Fix possible memory leak in CLUUserInteractionModule because of connected gesture recognizer Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant