Skip to content

Commit

Permalink
fix: wrap OnWindowMessage w/ handlescope (#24769)
Browse files Browse the repository at this point in the history
* fix: wrap OnWindowMessage w/ handlescope (#24716)

* Update electron_api_top_level_window.cc
  • Loading branch information
nornagon committed Jul 29, 2020
1 parent 7564453 commit 72d921e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions shell/browser/api/electron_api_top_level_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 @@ -290,6 +291,8 @@ void TopLevelWindow::OnWindowMessage(UINT message,
WPARAM w_param,
LPARAM l_param) {
if (IsWindowMessageHooked(message)) {
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)));
Expand Down

0 comments on commit 72d921e

Please sign in to comment.