From 89cb1513b9bee1af1589c88c7b830c25d4719cb8 Mon Sep 17 00:00:00 2001 From: Jonas Greifenhain <51089187+cadivus@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:49:21 +0200 Subject: [PATCH] Fix recent changes for Linux and add pipeline for testing Linux builds (#157) * Add workflow for testing Linux * Fix Linux build errors /webview_cef/example/linux/flutter/ephemeral/.plugin_symlinks/webview_cef/common/webview_js_handler.cc:180:21: error: enumeration value 'UNKNOWN' not handled in switch [-Werror,-Wswitch] /webview_cef/example/linux/flutter/ephemeral/.plugin_symlinks/webview_cef/common/webview_plugin.cc:434:24: error: 4 enumeration values not handled in switch: 'VTYPE_INVALID', 'VTYPE_NULL', 'VTYPE_BINARY'... [-Werror,-Wswitch] /webview_cef/example/linux/flutter/ephemeral/.plugin_symlinks/webview_cef/common/webview_plugin.cc:430:41: error: variable 'retValue' is uninitialized when used here [-Werror,-Wuninitialized] --- .github/workflows/test_linux_x86.yaml | 41 +++++++++++++++++++++++++++ common/webview_js_handler.cc | 4 +++ common/webview_plugin.cc | 8 ++++-- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test_linux_x86.yaml diff --git a/.github/workflows/test_linux_x86.yaml b/.github/workflows/test_linux_x86.yaml new file mode 100644 index 0000000..789030e --- /dev/null +++ b/.github/workflows/test_linux_x86.yaml @@ -0,0 +1,41 @@ +name: Test if the example app still builds on Linux x86 +on: + push: + branches: ["main"] + paths: + - "common/**" + - "example/**" + - "lib/**" + - "linux/**" + - "third/**" + - "pubspec.yaml" + - ".github/workflows/test_linux_x86.yaml" + pull_request: + paths: + - "common/**" + - "example/**" + - "lib/**" + - "linux/**" + - "third/**" + - "pubspec.yaml" + - ".github/workflows/test_linux_x86.yaml" + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + - run: | + sudo apt-get update -y + sudo apt-get install -y ninja-build libgtk-3-dev clang cmake pkg-config build-essential + - run: flutter --version + - run: lsb_release -a + - run: clang --version + - run: cmake --version + - run: g++ --version + - run: (cd example && flutter build linux) diff --git a/common/webview_js_handler.cc b/common/webview_js_handler.cc index 4961c11..4178896 100644 --- a/common/webview_js_handler.cc +++ b/common/webview_js_handler.cc @@ -214,6 +214,10 @@ bool CefJSBridge::EvaluateCallback(const CefString& callbackId, const JSValue& r args->SetList(1, arrayList); break; } + default: + // For avoiding values like + // error: enumeration value 'UNKNOWN' not handled in switch [-Werror,-Wswitch] + break; } // 메시지 전송 diff --git a/common/webview_plugin.cc b/common/webview_plugin.cc index ef36ab3..b4ffd76 100644 --- a/common/webview_plugin.cc +++ b/common/webview_plugin.cc @@ -427,7 +427,6 @@ namespace webview_cef { if (values == nullptr) { result(1, nullptr); - webview_value_unref(retValue); return; } @@ -444,7 +443,7 @@ namespace webview_cef { case VTYPE_STRING: retValue = webview_value_new_string(values->GetString().ToString().c_str()); break; - case VTYPE_LIST: + case VTYPE_LIST: { retValue = webview_value_new_list(); CefRefPtr list = values->GetList(); @@ -467,6 +466,11 @@ namespace webview_cef { } } break; + } + default: + // Return null as fallback + result(1, nullptr); + return; } result(1, retValue);