Skip to content

leave_workspace returns false the first time, and true the second time it is called. #63

Open

Description

@ghyatzo

after calling it the first time client.active_workspaces() is empty.
is this plugin specific or do you also incur in this issue?

Activity

  1. added
    bugSomething isn't working as intended
    needs researchThis issue needs further research
    on Oct 28, 2024
  2. alemidev commented on Feb 18, 2025

    @alemidev
    Member

    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!

  3. added
    coreThis issue is related to the core Rust library
    and removed
    bugSomething isn't working as intended
    on Feb 18, 2025
  4. alemidev commented on Mar 18, 2026

    @alemidev
    Member

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreThis issue is related to the core Rust libraryneeds researchThis issue needs further research

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions