From da3f4923f1887d4d5c9edbd753555e927099d441 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 12 May 2021 16:12:20 +0300 Subject: [PATCH] Scanner: Clean up display destroy listener in deferred global destroy func We also need to clean up the display destroy listener in the deferred global destroy func to avoid use-after-free bugs on the display tear down. --- src/wayland/tools/qtwaylandscanner.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wayland/tools/qtwaylandscanner.cpp b/src/wayland/tools/qtwaylandscanner.cpp index 27bfdf8f0b..165c2508b3 100644 --- a/src/wayland/tools/qtwaylandscanner.cpp +++ b/src/wayland/tools/qtwaylandscanner.cpp @@ -696,6 +696,7 @@ bool Scanner::process() printf(" object->m_global = nullptr;\n"); printf(" wl_event_source_remove(object->m_globalRemovedEvent);\n"); printf(" object->m_globalRemovedEvent = nullptr;\n"); + printf(" wl_list_remove(&object->m_displayDestroyedListener.link);\n"); printf(" object->%s_destroy_global();\n", interfaceNameStripped); printf(" return 0;\n"); printf(" }\n");