From a07b99f3ae88256eb8920db57c391af7e6242ce9 Mon Sep 17 00:00:00 2001 From: "dcarney@chromium.org" Date: Fri, 14 Jun 2013 13:40:47 +0000 Subject: [PATCH] build fix for d8-readline for 15142 R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/17028013 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15151 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/d8-readline.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/d8-readline.cc b/src/d8-readline.cc index 5226364c64..298518d72a 100644 --- a/src/d8-readline.cc +++ b/src/d8-readline.cc @@ -150,18 +150,19 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) { static Persistent current_completions; Isolate* isolate = read_line_editor.isolate_; Locker lock(isolate); + HandleScope scope; + Handle completions; if (state == 0) { - HandleScope scope; Local full_text = String::New(rl_line_buffer, rl_point); - Handle completions = - Shell::GetCompletions(isolate, String::New(text), full_text); - current_completions = Persistent::New(isolate, completions); + completions = Shell::GetCompletions(isolate, String::New(text), full_text); + current_completions.Reset(isolate, completions); current_index = 0; + } else { + completions = Local::New(isolate, current_completions); } - if (current_index < current_completions->Length()) { - HandleScope scope; + if (current_index < completions->Length()) { Handle index = Integer::New(current_index); - Handle str_obj = current_completions->Get(index); + Handle str_obj = completions->Get(index); current_index++; String::Utf8Value str(str_obj); return strdup(*str);