aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Sanne Wouda <sanne.wouda@gmail.com>2015-04-08 11:58:29 +0200
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-04-08 10:46:38 -0700
commitfbe28fd5d8274c298c825428d89fbe20f4ae111e (patch)
tree2619967b80f4070a5672aa21df211aa2ca089b4b
parent97aa1c033bcdd839ee3fe28431c786dde2354d13 (diff)
Tombstone only when explicitly removing a function.
Do not tombstone a function when it is evicted normally from the LRU cache. This broke changing `fish_function_path`, since that would evict all nodes, resulting in accidental tombstones, which caused autoloaded functions to never be reloaded. See #213.
-rw-r--r--function.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/function.cpp b/function.cpp
index 5d113c24..fb8dbf6a 100644
--- a/function.cpp
+++ b/function.cpp
@@ -66,12 +66,12 @@ function_autoload_t::function_autoload_t() : autoload_t(L"fish_function_path", N
{
}
-static bool function_remove_ignore_autoload(const wcstring &name);
+static bool function_remove_ignore_autoload(const wcstring &name, bool tombstone = true);
/** Callback when an autoloaded function is removed */
void function_autoload_t::command_removed(const wcstring &cmd)
{
- function_remove_ignore_autoload(cmd);
+ function_remove_ignore_autoload(cmd, false);
}
/**
@@ -237,7 +237,7 @@ int function_exists_no_autoload(const wcstring &cmd, const env_vars_snapshot_t &
return loaded_functions.find(cmd) != loaded_functions.end() || function_autoloader.can_load(cmd, vars);
}
-static bool function_remove_ignore_autoload(const wcstring &name)
+static bool function_remove_ignore_autoload(const wcstring &name, bool tombstone)
{
// Note: the lock may be held at this point, but is recursive
scoped_lock lock(functions_lock);
@@ -250,7 +250,7 @@ static bool function_remove_ignore_autoload(const wcstring &name)
// removing an auto-loaded function. prevent it from being
// auto-reloaded.
- if (iter->second.is_autoload)
+ if (iter->second.is_autoload && tombstone)
function_tombstones.insert(name);
loaded_functions.erase(iter);