diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-06-04 09:51:38 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-06-04 09:51:38 +0200 |
commit | 5ac122d18820010471eb630a0dfa1e399456cc4e (patch) | |
tree | 51ca62895c130a7287fd7cf303dd453a4dac58c2 /plugingui | |
parent | 558dd20585223baf1dfbe1bbe88e352334239ef5 (diff) |
Fix missing deletes reported by valgrind.
Diffstat (limited to 'plugingui')
-rw-r--r-- | plugingui/eventhandler.cc | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/plugingui/eventhandler.cc b/plugingui/eventhandler.cc index ea5516a..5fa50e1 100644 --- a/plugingui/eventhandler.cc +++ b/plugingui/eventhandler.cc @@ -81,11 +81,18 @@ void EventHandler::processEvents() } auto peekEvent = peekNextEvent(); - if(!peekEvent || (peekEvent->type() != EventType::resize)) + if(!peekEvent) { break; } + if(peekEvent->type() != EventType::resize) + { + delete peekEvent; + break; + } + delete peekEvent; + delete event; event = getNextEvent(); } @@ -108,11 +115,18 @@ void EventHandler::processEvents() } auto peekEvent = peekNextEvent(); - if(!peekEvent || (peekEvent->type() != EventType::mouseMove)) + if(!peekEvent) + { + break; + } + if(peekEvent->type() != EventType::mouseMove) { + delete peekEvent; break; } + delete peekEvent; + delete event; event = getNextEvent(); } @@ -216,13 +230,21 @@ void EventHandler::processEvents() } auto peekEvent = peekNextEvent(); - if(!peekEvent || (peekEvent->type() != EventType::scroll)) + if(!peekEvent) { break; } + if(peekEvent->type() != EventType::scroll) + { + delete peekEvent; + break; + } + delete peekEvent; auto scrollEvent = static_cast<ScrollEvent*>(event); delta += scrollEvent->delta; + + delete event; event = getNextEvent(); } |