Skip to content

Commit 24d89a5

Browse files
Fixed crash with the drawing mask. Fixed ASAN sanitizer launching under Linux/GCC
1 parent 5e26727 commit 24d89a5

File tree

5 files changed

+35
-12
lines changed

5 files changed

+35
-12
lines changed

Firmware/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,14 @@ elseif( ${TARGET_PLATFORM} STREQUAL "FIRMWARE_SIMULATOR" )
127127

128128
option( ENABLE_SANITIZE_BUILD "Build simultator with ASAN support" OFF)
129129
list(APPEND EXTRA_LIBS vcruntime user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
130-
131130
if( ${ENABLE_SANITIZE_BUILD} )
132-
target_compile_options( ${NORDIC_TARGET} PUBLIC /fsanitize=address )
131+
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
132+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /fsanitize=address")
133+
else()
134+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
135+
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
136+
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
137+
endif()
133138
endif()
134139
endif()
135140

Firmware/firmware_tests/coroutine/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ target_compile_features(
2222
cxx_std_20
2323
)
2424

25-
if( ${ENABLE_SANITIZE_BUILD} )
26-
target_compile_options( coroutine_experiments_app PRIVATE /fsanitize=address )
27-
endif()
25+
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
26+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /fsanitize=address")
27+
else()
28+
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
29+
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
30+
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
31+
endif()
2832

2933
target_link_libraries(
3034
coroutine_experiments_app

Firmware/graphics/lvgl_lib/lvgl_library/lv_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
321321
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
322322
* LV_LOG_LEVEL_NONE Do not log anything
323323
*/
324-
# define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
324+
# define LV_LOG_LEVEL LV_LOG_LEVEL_INFO
325325

326326
/* 1: Print the log with 'printf';
327327
* 0: user need to register a callback with `lv_log_register_print_cb`*/

Firmware/graphics/widgets_layer/gs_main_window_view.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void MainWindowView::initBackground() noexcept
2323

2424
auto createAlignedRect = [this](auto _aligmentType, lv_style_t* _style) {
2525
lv_obj_t* pObject{nullptr};
26-
auto parent = lv_scr_act();
26+
auto parent = m_pWindowRoot.get();
2727

2828
pObject = lv_obj_create(parent);
2929
lv_obj_set_size(pObject, MainWindowView::Width, MainWindowView::Height / 2);
@@ -55,7 +55,7 @@ void MainWindowView::initBackground() noexcept
5555
m_pYan.reset(createAlignedRect(LV_ALIGN_TOP_MID, &m_yanStyle));
5656

5757
auto createAlignedCircle = [this](auto _aligmentType, lv_style_t* _style) {
58-
auto parent = lv_scr_act();
58+
auto parent = m_pWindowRoot.get();
5959
lv_obj_t* pCircle = lv_obj_create(parent);
6060

6161
lv_obj_set_size(pCircle, MainWindowView::Width / 2, MainWindowView::Height / 2);
@@ -95,9 +95,23 @@ void MainWindowView::resetBackgroundStyle() noexcept
9595

9696
void MainWindowView::initMask() noexcept
9797
{
98-
constexpr std::uint8_t RoundedArea = 240;
99-
lv_draw_mask_radius_init(&radiusParam, &maskArea, RoundedArea, false);
100-
m_maskId = lv_draw_mask_add(&radiusParam, nullptr);
98+
m_pWindowRoot.reset(lv_obj_create(lv_scr_act()));
99+
auto container = m_pWindowRoot.get();
100+
lv_obj_set_size(container, MainWindowView::Width, MainWindowView::Height);
101+
lv_obj_center(container);
102+
lv_obj_set_style_radius(container, LV_RADIUS_CIRCLE, LV_PART_MAIN);
103+
lv_obj_set_scrollbar_mode(container,LV_SCROLLBAR_MODE_OFF);
104+
lv_obj_set_style_pad_all(container,0,LV_PART_MAIN);
105+
lv_obj_set_style_clip_corner(container,true,LV_PART_MAIN);
106+
lv_obj_set_style_border_width(container,0,LV_PART_MAIN);
107+
108+
// The drawing mask implementation causes the crash with the access violation.
109+
// For the current LVGL 8.0 latest version the solution hasn't been found
110+
// The best we can do now is an attempt to use the container for all of the widgtes with the given set of styles
111+
112+
// constexpr std::uint8_t RoundedArea = 240;
113+
// lv_draw_mask_radius_init(&radiusParam, &maskArea, RoundedArea, false);
114+
// m_maskId = lv_draw_mask_add(&radiusParam, nullptr);
101115

102116
// m_pObjMask.reset( lv_objmask_create( lv_disp_get_scr_act( nullptr ), nullptr ) );
103117

Firmware/graphics/widgets_layer/gs_main_window_view.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class MainWindowView : public IMainWindowView
4444
std::uint16_t m_maskId;
4545

4646
lv_draw_mask_radius_param_t radiusParam;
47-
47+
Meta::PointerWrapper<lv_obj_t, lv_obj_del> m_pWindowRoot;
4848
Meta::PointerWrapper<lv_obj_t, lv_obj_del> m_pIny;
4949
Meta::PointerWrapper<lv_obj_t, lv_obj_del> m_pInyCircle;
5050
Meta::PointerWrapper<lv_obj_t, lv_obj_del> m_pYan;

0 commit comments

Comments
 (0)