Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include/AdblockPlus/V8ValueHolder.h

Issue 5350367445385216: Fix the crashing (Closed)
Patch Set: Created July 1, 2014, 10:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 V8ValueHolder(v8::Isolate* isolate, v8::Persistent<T> value) 44 V8ValueHolder(v8::Isolate* isolate, v8::Persistent<T> value)
45 { 45 {
46 reset(isolate, value); 46 reset(isolate, value);
47 } 47 }
48 V8ValueHolder(v8::Isolate* isolate, v8::Handle<T> value) 48 V8ValueHolder(v8::Isolate* isolate, v8::Handle<T> value)
49 { 49 {
50 reset(isolate, value); 50 reset(isolate, value);
51 } 51 }
52 ~V8ValueHolder() 52 ~V8ValueHolder()
53 { 53 {
54 if (this->value.get()) 54 reset(isolate, v8::Persistent<T>());
Wladimir Palant 2014/07/02 09:35:12 I don't get it, with this change the code seems to
55 {
56 this->value->Dispose(this->isolate);
57 this->value.reset(0);
58 }
59 } 55 }
60 void reset(v8::Isolate* isolate, v8::Persistent<T> value) 56 void reset(v8::Isolate* isolate, v8::Persistent<T> value)
61 { 57 {
62 if (this->value.get()) 58 if (this->value.get())
63 { 59 {
64 this->value->Dispose(this->isolate); 60 this->value->Dispose(this->isolate);
65 this->value.reset(0); 61 this->value.reset(0);
66 } 62 }
67 63
68 if (!value.IsEmpty()) 64 if (!value.IsEmpty())
(...skipping 20 matching lines...) Expand all
89 { 85 {
90 return *value; 86 return *value;
91 } 87 }
92 private: 88 private:
93 v8::Isolate* isolate; 89 v8::Isolate* isolate;
94 std::auto_ptr<v8::Persistent<T> > value; 90 std::auto_ptr<v8::Persistent<T> > value;
95 }; 91 };
96 } 92 }
97 93
98 #endif 94 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld