From 30a1d09a8327db07962ae4274d54dbcda4dbaa5f Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Tue, 12 Apr 2022 02:30:02 -0700 Subject: [PATCH] Dealloc safety improvement Summary: From a different diff, it was pointed out that calling methods on self are discouraged: Generally you want to avoid calling methods on self in dealloc because it allows you to accidentally capture references to self in dealloc, which leads to zombies. In this case, a disconnect effectively invalidates a timer and disconnect the underlying socket. Both take place either way when the members are deallocated too. The only thing is not done is notify the caller via the event handler of a close event. In our case, the caller actually manually disconnects before deallocating so this is not an issue. Reviewed By: fabiomassimo Differential Revision: D35547600 fbshipit-source-id: 9b5b9892b657a69585943613bc81344b38dbef30 --- iOS/FlipperKit/FlipperPlatformWebSocket.mm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/iOS/FlipperKit/FlipperPlatformWebSocket.mm b/iOS/FlipperKit/FlipperPlatformWebSocket.mm index 3f88ebb9b..6716a6438 100644 --- a/iOS/FlipperKit/FlipperPlatformWebSocket.mm +++ b/iOS/FlipperKit/FlipperPlatformWebSocket.mm @@ -135,10 +135,6 @@ static constexpr int connectionKeepaliveSeconds = 10; return self; } -- (void)dealloc { - [self disconnect]; -} - - (void)connect { if (_socket) { return;