Permalink
Browse files

LruCache, bugfix: object locked in updater callback.

  • Loading branch information...
xicilion committed Dec 2, 2017
1 parent 66a5186 commit 83769322266dbd14970a961c5372af4005645a97
Showing with 5 additions and 3 deletions.
  1. +2 −0 fibjs/include/LruCache.h
  2. +3 −3 fibjs/src/util/LruCache.cpp
View
@@ -29,6 +29,8 @@ class LruCache : public LruCache_base {
m_checkTime.now();
}
FIBER_FREE();
public:
// object_base
virtual result_t toJSON(exlib::string key, v8::Local<v8::Value>& retVal);
@@ -102,12 +102,12 @@ result_t LruCache::get(exlib::string name, v8::Local<v8::Function> updater,
if (find != m_datas.end())
break;
if (updater.IsEmpty())
return 0;
std::map<exlib::string, obj_ptr<Event_base>>::iterator padding;
padding = m_paddings.find(sname);
if (padding == m_paddings.end()) {
if (updater.IsEmpty())
return 0;
e = new Event();
padding = m_paddings.insert(std::pair<exlib::string, obj_ptr<Event_base>>(sname, e)).first;
v8::Local<v8::Value> v = updater->Call(o, 1, &a);

0 comments on commit 8376932

Please sign in to comment.