You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
leave_workspace returns false the first time, and true the second time it is called. #63
this is (sadly) expected: while closing resources (leave buffer/workspace/client) we try to consume the Arc we have internally. If this succeeds, it means we had the last reference, so we return true. If the Arc isn't the last one, we still end up without a reference but knowing there are others, so we return false. Trying to close that resource again will be a no-op since there isn't any other reference to work with, so we just answer true. That last result is however a lie if it was false the first time and nothing more has been done: there will still be dangling references preventing the resource from being freed!
So basically: this is a badly designed expected behavior. We likely need to rethink how to handle dangling refs across FFI!
an idea to addess this behavior is to make all structs passing ffi just Weak<> wrappers and not full Arc<> wrappers, so they won't hold stuff from being dropped, but implies heavy changes on the api
Activity
alemidev commentedon Feb 18, 2025
this is (sadly) expected: while closing resources (leave buffer/workspace/client) we try to consume the Arc we have internally. If this succeeds, it means we had the last reference, so we return
true. If the Arc isn't the last one, we still end up without a reference but knowing there are others, so we returnfalse. Trying to close that resource again will be a no-op since there isn't any other reference to work with, so we just answertrue. That last result is however a lie if it wasfalsethe first time and nothing more has been done: there will still be dangling references preventing the resource from being freed!So basically: this is a badly designed expected behavior. We likely need to rethink how to handle dangling refs across FFI!
alemidev commentedon Mar 18, 2026
an idea to addess this behavior is to make all structs passing ffi just Weak<> wrappers and not full Arc<> wrappers, so they won't hold stuff from being dropped, but implies heavy changes on the api