fix a crash that caused by double-delete of a event handler

This commit is contained in:
Jinhao
2015-05-01 16:29:51 +08:00
parent f943673d3d
commit a64354900c
9 changed files with 144 additions and 102 deletions

View File

@@ -21,7 +21,6 @@
#include <nana/gui/layout_utility.hpp>
#include <nana/gui/detail/effects_renderer.hpp>
#include <stdexcept>
#include <algorithm>
namespace nana
{
@@ -192,7 +191,7 @@ namespace detail
switch(evtid)
{
case event_code::mouse_drop:
wd->flags.dropable = (is_make || (0 != wd->together.attached_events->mouse_dropfiles.length()));
wd->flags.dropable = (is_make || (0 != wd->together.events_ptr->mouse_dropfiles.length()));
break;
default:
break;
@@ -985,11 +984,15 @@ namespace detail
}
else
{
auto i = std::find_if(attr_cap.begin(), attr_cap.end(),
[wd](const std::pair<core_window_t*, bool> & x){ return (x.first == wd);});
for (auto i = attr_cap.begin(), end = attr_cap.end(); i != end; ++i)
{
if (i->first == wd)
{
attr_cap.erase(i);
break;
}
}
if(i != attr_cap.end())
attr_cap.erase(i);
return attr_.capture.window;
}
return wd;