From 7fea766f99262144d8c8a741906a134bce286456 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 22 Sep 2018 00:37:36 +0800 Subject: [PATCH 1/3] fix bug that causes dead-lock under Linux --- source/gui/detail/bedrock_posix.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/gui/detail/bedrock_posix.cpp b/source/gui/detail/bedrock_posix.cpp index 62738e98..0504cf95 100644 --- a/source/gui/detail/bedrock_posix.cpp +++ b/source/gui/detail/bedrock_posix.cpp @@ -973,7 +973,12 @@ namespace detail case Expose: if(msgwnd->visible && (msgwnd->root_graph->empty() == false)) { - nana::detail::platform_scope_guard lock; + nana::internal_scope_guard lock; + //Don't lock this scope using platform-scope-guard. Because it would cause the platform-scope-lock to be locked + //before the internal-scope-guard, and the order of locking would cause dead-lock. + // + //Locks this scope using internal-scope-guard is correct and safe. In the scope, the Xlib functions aren't called + //directly. if(msgwnd->is_draw_through()) { msgwnd->other.attribute.root->draw_through(); From 2c3d75c7091178056640d914d3efd0518815df92 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 25 Sep 2018 02:07:15 +0800 Subject: [PATCH 2/3] fix bug of C++ feature detection(#338) --- include/nana/c++defines.hpp | 6 +++--- source/gui/widgets/label.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index ef5d8e9f..9456887f 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -211,10 +211,10 @@ #undef _nana_std_optional -#if ((defined(_MSC_VER) && (_MSC_VER >= 1912) && ((!defined(_MSVC_LANG)) || _MSVC_LANG < 201703))) || \ - ((__cplusplus < 201703L) || \ +#if ((defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || _MSVC_LANG < 201703))) || \ + ((!defined(_MSC_VER)) && ((__cplusplus < 201703L) || \ (defined(__clang__) && (__clang_major__ * 100 + __clang_minor__ < 400)) || \ - (!defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 701)) \ + (!defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 701))) \ ) # define _nana_std_optional #endif diff --git a/source/gui/widgets/label.cpp b/source/gui/widgets/label.cpp index 03b88215..88fe88f2 100644 --- a/source/gui/widgets/label.cpp +++ b/source/gui/widgets/label.cpp @@ -303,7 +303,7 @@ namespace nana extent_size.width = width_px; for (auto & vsline : rs.vslines) - extent_size.height += vsline.extent_height_px; + extent_size.height += static_cast(vsline.extent_height_px); content_lines.emplace_back(std::move(rs.vslines)); From b6028f807914d8e3271a2fcc393686fa83212a02 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 1 Oct 2018 07:43:57 +0800 Subject: [PATCH 3/3] fix bug that font is missing when measure a zero-sized label --- source/gui/widgets/label.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/gui/widgets/label.cpp b/source/gui/widgets/label.cpp index 88fe88f2..74bedf81 100644 --- a/source/gui/widgets/label.cpp +++ b/source/gui/widgets/label.cpp @@ -891,7 +891,8 @@ namespace nana if(graph_ptr->empty()) { graph_ptr = &substitute; - graph_ptr->make({ 10, 10 }); + substitute.make({ 10, 10 }); + substitute.typeface(this->typeface()); } return impl->renderer.measure(*graph_ptr, limited, impl->text_align, impl->text_align_v);