Skip to content

Commit

Permalink
fix: wrap OnWindowMessage w/ handlescope (#24716)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Jul 28, 2020
1 parent b6321cc commit 834408a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions shell/browser/api/electron_api_base_window.cc
Expand Up @@ -14,6 +14,7 @@
#include "shell/browser/api/electron_api_menu.h"
#include "shell/browser/api/electron_api_view.h"
#include "shell/browser/api/electron_api_web_contents.h"
#include "shell/browser/javascript_environment.h"
#include "shell/common/color_util.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/file_path_converter.h"
Expand Down Expand Up @@ -296,9 +297,12 @@ void BaseWindow::OnNewWindowForTab() {
#if defined(OS_WIN)
void BaseWindow::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
if (IsWindowMessageHooked(message)) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
messages_callback_map_[message].Run(
ToBuffer(isolate(), static_cast<void*>(&w_param), sizeof(WPARAM)),
ToBuffer(isolate(), static_cast<void*>(&l_param), sizeof(LPARAM)));
ToBuffer(isolate, static_cast<void*>(&w_param), sizeof(WPARAM)),
ToBuffer(isolate, static_cast<void*>(&l_param), sizeof(LPARAM)));
}
}
#endif
Expand Down

0 comments on commit 834408a

Please sign in to comment.