Skip to content

NetBox IdleThread starts too early and can crash #512

@alabuzhev

Description

@alabuzhev

GetGlobalInfoW calls CreatePlugin:

CreatePlugin();

CreatePlugin calls CreateFarPlugin:

FarPlugin = CreateFarPlugin(HInstanceDLL);

CreateFarPlugin calls Initialize:

Result->Initialize();

Initialize starts a background thread:

FTIdleThread->InitIdleThread("NetBox IdleThread");

Unfortunately, Far can still unload the plugin after calling GetGlobalInfoW under certain circumstances.
E.g. if it requires a newer Far version or if a plugin with the same GUID is already loaded.

If it happens and the thread managed to start already, it will get its code yanked off suddenly, execute rubbish and cause EXCEPTION_ACCESS_VIOLATION + EXCEPTION_EXECUTE_FAULT.

Example: https://bugs.farmanager.com/view.php?id=4097

It's better to start it later, when the plugin is truly loaded, e.g. in SetStartupInfoW.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions