Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(962)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp

Issue 2004423007: SourceLocation: Fix use-after-move. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
index f7e4197f4b94008753555589c481ea87de5ecacc..c806cf2a0ab609b14bf1862d1a30a82c0134ecea 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SourceLocation.cpp
@@ -41,8 +41,10 @@ std::unique_ptr<V8StackTrace> captureStackTrace()
PassOwnPtr<SourceLocation> SourceLocation::capture(const String& url, unsigned lineNumber, unsigned columnNumber)
{
std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace();
- if (stackTrace && !stackTrace->isEmpty())
- return SourceLocation::create(stackTrace->topSourceURL(), stackTrace->topLineNumber(), stackTrace->topColumnNumber(), std::move(stackTrace), 0);
+ if (stackTrace && !stackTrace->isEmpty()) {
+ const V8StackTrace* stackTracePtr = stackTrace.get();
Yuki 2016/05/26 06:55:50 I'm a bit uneasy to use a raw pointer here. co
kinaba 2016/05/26 07:14:19 Makes sense. Done.
+ return SourceLocation::create(stackTracePtr->topSourceURL(), stackTracePtr->topLineNumber(), stackTracePtr->topColumnNumber(), std::move(stackTrace), 0);
+ }
return SourceLocation::create(url, lineNumber, columnNumber, std::move(stackTrace));
}
@@ -50,8 +52,10 @@ PassOwnPtr<SourceLocation> SourceLocation::capture(const String& url, unsigned l
PassOwnPtr<SourceLocation> SourceLocation::capture(ExecutionContext* executionContext)
{
std::unique_ptr<V8StackTrace> stackTrace = captureStackTrace();
- if (stackTrace && !stackTrace->isEmpty())
- return SourceLocation::create(stackTrace->topSourceURL(), stackTrace->topLineNumber(), stackTrace->topColumnNumber(), std::move(stackTrace), 0);
+ if (stackTrace && !stackTrace->isEmpty()) {
+ const V8StackTrace* stackTracePtr = stackTrace.get();
+ return SourceLocation::create(stackTracePtr->topSourceURL(), stackTracePtr->topLineNumber(), stackTracePtr->topColumnNumber(), std::move(stackTrace), 0);
+ }
Document* document = executionContext && executionContext->isDocument() ? toDocument(executionContext) : nullptr;
if (document) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698