From dcdeba7d2e0398fc9017cb4671420b20768dd95d Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 20 Mar 2017 06:33:37 +0800 Subject: [PATCH] fix issue that filebox may throw exception(#191) --- include/nana/gui/filebox.hpp | 2 +- source/gui/filebox.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/nana/gui/filebox.hpp b/include/nana/gui/filebox.hpp index 561dc5b7..1800eb9f 100644 --- a/include/nana/gui/filebox.hpp +++ b/include/nana/gui/filebox.hpp @@ -1,7 +1,7 @@ /** * Filebox * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at diff --git a/source/gui/filebox.cpp b/source/gui/filebox.cpp index ec6c08a5..76e5d734 100644 --- a/source/gui/filebox.cpp +++ b/source/gui/filebox.cpp @@ -1,7 +1,7 @@ /* * Filebox * Nana C++ Library(http://www.nanapro.org) -* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) +* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -997,6 +997,9 @@ namespace nana OPENFILENAME ofn; memset(&ofn, 0, sizeof ofn); + + internal_scope_guard lock; + ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = reinterpret_cast(API::root(impl_->owner)); ofn.lpstrFile = &(wfile[0]);