!2040 fix pc preview crash bug

Merge pull request !2040 from lihao71/OpenHarmony-3.1-Release
This commit is contained in:
openharmony_ci
2022-03-26 14:20:57 +00:00
committed by Gitee
9 changed files with 53 additions and 16 deletions
+6 -2
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -29,7 +29,7 @@ use_curl_download = true
accessibility_support = true
rich_components_support = true
advance_components_support = false
form_components_support = false
form_components_support = true
xcomponent_components_support = false
plugin_components_support = false
js_pa_support = false
@@ -38,6 +38,10 @@ enable_rosen_backend = false
enable_standard_input = false
enable_system_clipboard = false
if (form_components_support) {
defines += [ "FORM_SUPPORTED" ]
}
cflags_cc = [
"-std=c++17",
"-Wno-thread-safety-attributes",
+6 -2
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -33,7 +33,7 @@ use_curl_download = true
accessibility_support = true
rich_components_support = true
advance_components_support = false
form_components_support = false
form_components_support = true
plugin_components_support = false
xcomponent_components_support = false
js_pa_support = false
@@ -41,6 +41,10 @@ connect_server_support = false
enable_rosen_backend = false
enable_standard_input = false
if (form_components_support) {
defines += [ "FORM_SUPPORTED" ]
}
cflags_cc = [
"-std=c++17",
"-DWINVER=0x0601",
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -299,26 +299,26 @@ extern uint8_t* _binary_fa_black_clock_widget_second_png_end;
// Use objcopy transform to compiled object file.
// The following parameters represent the beginning and end of the file.
extern uint8_t _binary_ic_public_drawer_svg_start[];
extern uint8_t _binary_ic_public_drawer_svg_end[];
extern uint8_t* _binary_ic_public_drawer_svg_end;
// binary/container_modal_window_close.svg
extern uint8_t _binary_container_modal_window_close_svg_start[];
extern uint8_t _binary_container_modal_window_close_svg_end[];
extern uint8_t* _binary_container_modal_window_close_svg_end;
// binary/container_modal_window_maximize.svg
extern uint8_t _binary_container_modal_window_maximize_svg_start[];
extern uint8_t _binary_container_modal_window_maximize_svg_end[];
extern uint8_t* _binary_container_modal_window_maximize_svg_end;
// binary/container_modal_window_minimize.svg
extern uint8_t _binary_container_modal_window_minimize_svg_start[];
extern uint8_t _binary_container_modal_window_minimize_svg_end[];
extern uint8_t* _binary_container_modal_window_minimize_svg_end;
// binary/container_modal_window_recover.svg
extern uint8_t _binary_container_modal_window_recover_svg_start[];
extern uint8_t _binary_container_modal_window_recover_svg_end[];
extern uint8_t* _binary_container_modal_window_recover_svg_end;
// binary/container_modal_window_split_left.svg
extern uint8_t _binary_container_modal_window_split_left_svg_start[];
extern uint8_t _binary_container_modal_window_split_left_svg_end[];
extern uint8_t* _binary_container_modal_window_split_left_svg_end;
namespace OHOS::Ace {
namespace {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -29,7 +29,7 @@ void JsClickFunction::Execute()
#ifdef USE_V8_ENGINE
V8DeclarativeEngineInstance::TriggerPageUpdate();
#elif USE_QUICKJS_ENGINE
QJSDeclarativeEngineInstance::TriggerPageUpdate(QJSContext::Current());
QJSDeclarativeEngineInstance::TriggerPageUpdate(QJSDeclarativeEngineInstance::GetCurrentContext());
#elif USE_ARK_ENGINE
JsiDeclarativeEngineInstance::TriggerPageUpdate(JsiDeclarativeEngineInstance::GetCurrentRuntime());
#endif
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -102,6 +102,11 @@ public:
return AceType::RawPtr(engineInstance_->GetDelegate());
}
RefPtr<QJSDeclarativeEngineInstance> GetEngineInstance()
{
return engineInstance_;
}
#if defined(WINDOWS_PLATFORM) || defined(MAC_PLATFORM)
void ReplaceJSContent(const std::string& url, const std::string componentName);
#endif
@@ -25,6 +25,7 @@
#include "base/log/ace_trace.h"
#include "base/log/event_report.h"
#include "base/log/log.h"
#include "frameworks/bridge/common/utils/engine_helper.h"
#include "frameworks/bridge/declarative_frontend/engine/bindings_implementation.h"
#include "frameworks/bridge/declarative_frontend/engine/quickjs/modules/qjs_module_manager.h"
#include "frameworks/bridge/declarative_frontend/engine/quickjs/qjs_helpers.h"
@@ -117,6 +118,22 @@ RefPtr<JsAcePage> QJSDeclarativeEngineInstance::GetStagingPage(JSContext* ctx)
}
}
JSContext* QJSDeclarativeEngineInstance::GetCurrentContext()
{
auto engine = EngineHelper::GetCurrentEngine();
auto qjsEngine = AceType::DynamicCast<QJSDeclarativeEngine>(engine);
if (!qjsEngine) {
LOGE("qjsEngine is null");
return nullptr;
}
auto engineInstance = qjsEngine->GetEngineInstance();
if (engineInstance == nullptr) {
LOGE("engineInstance is nullptr");
return nullptr;
}
return engineInstance->GetQJSContext();
}
void QJSDeclarativeEngineInstance::PushJSCommand(const RefPtr<JsCommand>& jsCommand, bool forcePush) const
{
auto page = GetRunningPage();
@@ -68,6 +68,7 @@ public:
static RefPtr<JsAcePage> GetRunningPage(JSContext* ctx);
static RefPtr<JsAcePage> GetStagingPage(JSContext* ctx);
static JSContext* GetCurrentContext();
void SetStagingPage(const RefPtr<JsAcePage>& page);
+4 -2
View File
@@ -351,8 +351,10 @@ template("ace_core_source_set") {
if (defined(config.form_components_support) &&
config.form_components_support) {
sources += [ "common/form_manager.cpp" ]
deps += [ "$ace_root/frameworks/core/components/form:ace_core_components_form_$platform" ]
if (!use_mingw_win && !use_mac) {
sources += [ "common/form_manager.cpp" ]
deps += [ "$ace_root/frameworks/core/components/form:ace_core_components_form_$platform" ]
}
}
if (defined(config.build_container_scope_lib) &&
@@ -266,6 +266,10 @@ public:
LOGI("OnDataReloaded()");
ACE_SCOPED_TRACE("OnDataReloaded");
if (!lazyForEachComponent_) {
LOGE("lazyForEachComponent_ is nullptr");
return;
}
LazyForEachCache cache(lazyForEachComponent_);
size_t oldCount = count_;
count_ = cache.TotalCount();