From 5ac122d18820010471eb630a0dfa1e399456cc4e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 4 Jun 2016 09:51:38 +0200 Subject: Fix missing deletes reported by valgrind. --- plugingui/eventhandler.cc | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'plugingui') 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(event); delta += scrollEvent->delta; + + delete event; event = getNextEvent(); } -- cgit v1.2.3