From ff566de5ddda2f75e17a91c507b913f04f72c3e7 Mon Sep 17 00:00:00 2001 From: Matthieu Beghin Date: Mon, 26 Sep 2022 11:29:55 +0200 Subject: [PATCH] Fixed possible random issue when creating client Set handler before initializing connection connection would get a frame before "_handler" is valid --- SyphonClientBase.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SyphonClientBase.m b/SyphonClientBase.m index 6c74b61..042f96a 100644 --- a/SyphonClientBase.m +++ b/SyphonClientBase.m @@ -70,11 +70,11 @@ - (instancetype)initWithServerDescription:(NSDictionary *)descri { _lock = OS_SPINLOCK_INIT; - _connectionManager = [[SyphonClientConnectionManager alloc] initWithServerDescription:description]; - _handler = [handler copy]; // copy don't retain _serverDescription = [description retain]; + _connectionManager = [[SyphonClientConnectionManager alloc] initWithServerDescription:description]; + [[SyphonServerDirectory sharedDirectory] addObserver:self forKeyPath:@"servers" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew