Here's the AddBinding function:
bool EventManager::AddBinding(Binding *l_binding){
if (m_bindings.find(l_binding->m_name) != m_bindings.end())
return false;
return m_bindings.emplace(l_binding->m_name, l_binding).second;
}
And here are the lines which crash program:
if (m_bindings.find(l_binding->m_name) != m_bindings.end()) return false;
return m_bindings.emplace(l_binding->m_name, l_binding).second;
They both crash program, I tried to comment the first and the second line, both resulted the same way. Is it something with m_bindings variable?
m_bindings is std::unordered_map<std::string, Binding*> type
Here's the pointer:
struct Binding{
Binding(const std::string& l_name): m_name(l_name), m_details(l_name), c(0){}
void BindEvent(EventType l_type, EventInfo l_info = EventInfo()){
m_events.emplace_back(l_type, l_info);
}
Events m_events;
std::string m_name;
int c; // Count of events that are "happening".
EventDetails m_details;
};
So, what's the problem!?