Fix crashes about persistent v8 functions.
This commit is contained in:
		
					parent
					
						
							
								e4bfa373de
							
						
					
				
			
			
				commit
				
					
						61c63a6af9
					
				
			
		
					 2 changed files with 3 additions and 4 deletions
				
			
		|  | @ -63,9 +63,8 @@ void IDWeakMap::Add(const v8::FunctionCallbackInfo<v8::Value>& args) { | |||
|   v8::Local<v8::Object> v8_value = args[0]->ToObject(); | ||||
|   v8_value->SetHiddenValue(v8::String::New("IDWeakMapKey"), ToV8Value(key)); | ||||
| 
 | ||||
|   RefCountedV8Object& value = self->map_[key]; | ||||
|   value->reset(v8_value); | ||||
|   value->MakeWeak(self, WeakCallback); | ||||
|   self->map_[key] = new RefCountedPersistent<v8::Object>(v8_value); | ||||
|   self->map_[key]->MakeWeak(self, WeakCallback); | ||||
| 
 | ||||
|   args.GetReturnValue().Set(key); | ||||
| } | ||||
|  |  | |||
|  | @ -226,7 +226,7 @@ bool V8ValueCanBeConvertedTo<atom::NativeWindow*>(v8::Handle<v8::Value> value) { | |||
| } | ||||
| 
 | ||||
| template<> inline | ||||
| bool V8ValueCanBeConvertedTo<v8::Persistent<v8::Function>>( | ||||
| bool V8ValueCanBeConvertedTo<atom::RefCountedV8Function>( | ||||
|     v8::Handle<v8::Value> value) { | ||||
|   return value->IsFunction(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Cheng Zhao
				Cheng Zhao