From 818f42927c498c35ed541aed7e312fb2c2c97afd Mon Sep 17 00:00:00 2001 From: Alex Jabbour Date: Thu, 22 Feb 2024 15:02:58 -0500 Subject: [PATCH] Revert "Prevent `libreoffice` global from clearing after `window.close()`" --- .github/workflows/release.yml | 2 -- qa/index.html | 1 - qa/index.js | 6 +----- src/electron/office/office_client.cc | 11 +++-------- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47677bc..75242f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,11 +29,9 @@ jobs: - name: Windows x64 os: macro-windows runner: WINDOWS_RUNNER_INSTANCE_ID - working_dir: el - name: Linux x64 os: macro-linux runner: LINUX_RUNNER_INSTANCE_ID - working_dir: el name: Build for ${{ matrix.name }} uses: ./.github/workflows/build.yml with: diff --git a/qa/index.html b/qa/index.html index b15b0ac..5afbc77 100644 --- a/qa/index.html +++ b/qa/index.html @@ -53,7 +53,6 @@
-
diff --git a/qa/index.js b/qa/index.js index 65c991f..427c1bc 100644 --- a/qa/index.js +++ b/qa/index.js @@ -156,10 +156,9 @@ function insertTable() { Col: { value: 3, type: 'long' }, }); } -let winhandle; function iframewin() { const url = 'https://github.com/coparse-inc/electron-libreoffice'; - winhandle = window.open('about:blank', 'bug_dialog', 'nodeIntegration=no'); + const winhandle = window.open('about:blank', 'bug_dialog', 'nodeIntegration=no'); winhandle.focus(); const iFrameStyle = 'position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;'; @@ -167,6 +166,3 @@ function iframewin() { `` ); } -function closeiframewin() { - winhandle.close(); -} diff --git a/src/electron/office/office_client.cc b/src/electron/office/office_client.cc index b57d20d..cb70065 100644 --- a/src/electron/office/office_client.cc +++ b/src/electron/office/office_client.cc @@ -81,8 +81,6 @@ static void GetOfficeHandle(v8::Local name, } } // namespace -base::AtomicRefCount g_client_counter{0}; - // static void OfficeClient::InstallToContext(v8::Local context) { v8::Context::Scope context_scope(context); @@ -104,7 +102,6 @@ void OfficeClient::InstallToContext(v8::Local context) { GetOfficeHandle, nullptr, v8::MaybeLocal(), v8::AccessControl::ALL_CAN_READ, v8::PropertyAttribute::ReadOnly) .Check(); - g_client_counter.Increment(); } void OfficeClient::Unset() { @@ -114,11 +111,9 @@ void OfficeClient::Unset() { // static void OfficeClient::RemoveFromContext(v8::Local /*context*/) { - if (!g_client_counter.Decrement()) { - if (lazy_tls->Get()) - lazy_tls->Get()->Unset(); - lazy_tls->Set(nullptr); - } + if (lazy_tls->Get()) + lazy_tls->Get()->Unset(); + lazy_tls->Set(nullptr); } OfficeClient::OfficeClient()