From 738178dec30b73f5d82b0ba7ec2c13f25a60b41c Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 14 Nov 2016 06:57:42 +0800 Subject: [PATCH] fix freezing of filebox when opens in other thread --- source/gui/filebox.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/gui/filebox.cpp b/source/gui/filebox.cpp index ae57b0f7..21c5de30 100644 --- a/source/gui/filebox.cpp +++ b/source/gui/filebox.cpp @@ -1044,10 +1044,13 @@ namespace nana if (!impl_->open_or_save) ofn.Flags = OFN_OVERWRITEPROMPT; //Overwrite prompt if it is save mode ofn.Flags |= OFN_NOCHANGEDIR; - - if(FALSE == (impl_->open_or_save ? ::GetOpenFileName(&ofn) : ::GetSaveFileName(&ofn))) - return false; - + + { + internal_revert_guard revert; + if (FALSE == (impl_->open_or_save ? ::GetOpenFileName(&ofn) : ::GetSaveFileName(&ofn))) + return false; + } + wfile.resize(std::wcslen(wfile.data())); impl_->file = to_utf8(wfile); #elif defined(NANA_POSIX)