Skip to content

Commit

Permalink
initialise member variable in RCTWindowSafeAreaProxy startObservingSa…
Browse files Browse the repository at this point in the history
…feArea to prevent potential race

Summary:
changelog: [internal]


_currentSafeAreaInsets should be initialised as part of `startObservingSafeArea` to make sure it is set before accessed.

Even though, right now _currentSafeAreaInsets is always set before it is read because notification RCTUserInterfaceStyleDidChangeNotification fires eagerly, it might change in the future and introduce a bug.

Differential Revision: D69846681
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Feb 19, 2025
1 parent d69874f commit c1c600e
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ - (void)startObservingSafeArea
std::lock_guard<std::mutex> lock(_mutex);
if (!_isObserving) {
_isObserving = YES;
_currentSafeAreaInsets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_interfaceFrameDidChange)
name:RCTUserInterfaceStyleDidChangeNotification
Expand Down

0 comments on commit c1c600e

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy