From ae6df703f5e15548b7dd076d5763adee547d6444 Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Tue, 29 Sep 2020 16:22:50 -0300
Subject: [PATCH] qt/game_list: Give GameListSearchField::KeyReleaseEater a
 parent

This fixes a memory leak as KeyReleaseEater's destructor was never
called.
---
 src/yuzu/game_list.cpp | 5 +++--
 src/yuzu/game_list_p.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index a9738e298a..70d8651127 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -25,7 +25,8 @@
 #include "yuzu/main.h"
 #include "yuzu/uisettings.h"
 
-GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist) : gamelist{gamelist} {}
+GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist, QObject* parent)
+    : QObject(parent), gamelist{gamelist} {}
 
 // EventFilter in order to process systemkeys while editing the searchfield
 bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* event) {
@@ -116,7 +117,7 @@ void GameListSearchField::setFocus() {
 }
 
 GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
-    auto* const key_release_eater = new KeyReleaseEater(parent);
+    auto* const key_release_eater = new KeyReleaseEater(parent, this);
     layout_filter = new QHBoxLayout;
     layout_filter->setMargin(8);
     label_filter = new QLabel;
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index 92779a9c7b..248855affc 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -330,7 +330,7 @@ public:
 private:
     class KeyReleaseEater : public QObject {
     public:
-        explicit KeyReleaseEater(GameList* gamelist);
+        explicit KeyReleaseEater(GameList* gamelist, QObject* parent = nullptr);
 
     private:
         GameList* gamelist = nullptr;