Merge pull request #2527 from vitorpamplona/claude/remove-group-on-leave-JTVQb
Fix memory leak when leaving Marmot groups
This commit is contained in:
@@ -2319,6 +2319,12 @@ class Account(
|
||||
}
|
||||
|
||||
val outbound = manager.leaveGroup(nostrGroupId)
|
||||
// manager.leaveGroup already wiped MLS state, relay subscriptions and
|
||||
// the persisted message log. Drop the in-memory chatroom too — that
|
||||
// releases the strong refs to the decrypted inner notes so LocalCache
|
||||
// (which holds them weakly) can GC them, and the Notification feed
|
||||
// (which iterates marmotGroupList.rooms) stops surfacing the group.
|
||||
marmotGroupList.removeGroup(nostrGroupId)
|
||||
client.publish(outbound.signedEvent, groupRelays)
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -316,7 +316,6 @@ fun MarmotGroupInfoScreen(
|
||||
scope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
accountViewModel.leaveMarmotGroup(nostrGroupId)
|
||||
accountViewModel.account.marmotGroupList.removeGroup(nostrGroupId)
|
||||
nav.nav(Route.Message)
|
||||
} catch (e: Exception) {
|
||||
isLeaving = false
|
||||
|
||||
Reference in New Issue
Block a user