Skip to content

Commit

Permalink
Keep onto intermediate values until the client is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Sep 26, 2024
1 parent 9ef5dcc commit 7b6f925
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/api/rust/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type RustRoomInfo struct {
type RustClient struct {
FFIClient *matrix_sdk_ffi.Client
roomsListener *RoomsListener
entriesController *matrix_sdk_ffi.RoomListDynamicEntriesController
entriesAdapters *matrix_sdk_ffi.RoomListEntriesWithDynamicAdaptersResult
allRooms *matrix_sdk_ffi.RoomList
rooms map[string]*RustRoomInfo
roomsMu *sync.RWMutex
Expand Down Expand Up @@ -287,6 +289,14 @@ func (c *RustClient) Close(t ct.TestLike) {
}
}
c.roomsMu.Unlock()
if c.entriesController != nil {
c.entriesController.Destroy()
c.entriesController = nil
}
if c.entriesAdapters != nil {
c.entriesAdapters.Destroy()
c.entriesAdapters = nil
}
c.FFIClient.Destroy()
c.FFIClient = nil
if c.notifClient != nil {
Expand Down Expand Up @@ -400,8 +410,8 @@ func (c *RustClient) StartSyncing(t ct.TestLike) (stopSyncing func(), err error)
entriesAdapters := c.allRooms.EntriesWithDynamicAdapters(1000, allRoomsListener)
entriesController := entriesAdapters.Controller()
entriesController.SetFilter(matrix_sdk_ffi.RoomListEntriesDynamicFilterKindNonLeft{})
entriesController.Destroy()
entriesAdapters.Destroy()
c.entriesController = entriesController
c.entriesAdapters = entriesAdapters

isSyncing := false

Expand Down

0 comments on commit 7b6f925

Please sign in to comment.