close nostrdb and disconnect from relays on logout
This was causing crashing and corruption issues. This should have been handled by the garbage collector, but for some reason old references still hang around. Add a "close" method to DamusState which disconnects from relays and closes nostrdb. Changelog-Fixed: Fix crash when logging out and switching accounts Changelog-Fixed: Fix persistent local notifications even after logout Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -624,7 +624,7 @@ struct ContentView: View {
|
||||
|
||||
// out of space or something?? maybe we need a in-memory fallback
|
||||
if mndb == nil {
|
||||
notify(.logout)
|
||||
logout(nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1082,3 +1082,10 @@ func on_open_url(state: DamusState, url: URL, result: @escaping (OpenResult?) ->
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func logout(_ state: DamusState?)
|
||||
{
|
||||
state?.close()
|
||||
notify(.logout)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user