Skip to content

Commit c25c79d

Browse files
fix
This resolves an issue where a very small memory leak could occur within the ConnectionApprovedMessage.
1 parent bdcb40b commit c25c79d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ConnectionApprovedMessage.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public void Handle(ref NetworkContext context)
262262
{
263263
NetworkLog.LogWarning($"[Client-{OwnerClientId}] Receiving duplicate connection approved. Client is already connected!");
264264
}
265+
ConnectedClientIds.Dispose();
265266
return;
266267
}
267268

@@ -304,6 +305,9 @@ public void Handle(ref NetworkContext context)
304305
}
305306
}
306307

308+
// Dispose after it has been used.
309+
ConnectedClientIds.Dispose();
310+
307311
// Only if scene management is disabled do we handle NetworkObject synchronization at this point
308312
if (!networkManager.NetworkConfig.EnableSceneManagement)
309313
{
@@ -387,7 +391,6 @@ public void Handle(ref NetworkContext context)
387391
}
388392
}
389393
}
390-
ConnectedClientIds.Dispose();
391394
}
392395
}
393396
}

0 commit comments

Comments
 (0)