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.
This commit is contained in:
Vlad Zahorodnii 2021-05-12 16:12:20 +03:00
parent e4271a787f
commit da3f4923f1

View file

@ -696,6 +696,7 @@ bool Scanner::process()
printf(" object->m_global = nullptr;\n"); printf(" object->m_global = nullptr;\n");
printf(" wl_event_source_remove(object->m_globalRemovedEvent);\n"); printf(" wl_event_source_remove(object->m_globalRemovedEvent);\n");
printf(" object->m_globalRemovedEvent = nullptr;\n"); printf(" object->m_globalRemovedEvent = nullptr;\n");
printf(" wl_list_remove(&object->m_displayDestroyedListener.link);\n");
printf(" object->%s_destroy_global();\n", interfaceNameStripped); printf(" object->%s_destroy_global();\n", interfaceNameStripped);
printf(" return 0;\n"); printf(" return 0;\n");
printf(" }\n"); printf(" }\n");