Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
krtcore
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amd-design
krtcore
Commits
cd4917c6
Commit
cd4917c6
authored
Mar 01, 2016
by
NTAuthority
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix eventsystem-related quit/destruction crash
parent
853d4b4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
+16
-1
EventSystem.h
krt/game/include/EventSystem.h
+16
-1
No files found.
krt/game/include/EventSystem.h
View file @
cd4917c6
...
...
@@ -291,10 +291,20 @@ struct EventListener
:
catcher
(
nullptr
)
{
}
~
State
()
{
for
(
auto
&
listener
:
listeners
)
{
// so we won't try destructing
listener
->
m_hasListener
=
false
;
}
}
};
template
<
typename
TCallback
>
EventListener
(
const
TCallback
&
callback
)
:
m_hasListener
(
true
)
{
m_handler
=
callback
;
...
...
@@ -303,7 +313,10 @@ struct EventListener
~
EventListener
()
{
GetState
()
->
listeners
.
erase
(
this
);
if
(
m_hasListener
)
{
GetState
()
->
listeners
.
erase
(
this
);
}
}
void
Catch
()
...
...
@@ -323,6 +336,8 @@ struct EventListener
private
:
std
::
function
<
void
(
const
T
*
)
>
m_handler
;
bool
m_hasListener
;
// static members
public:
static
void
Handle
(
const
T
*
event
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment