Fix memory leak in Appmenu when using compact menu
Summary:
::createMenu sometimes creates a new menu, sometimes returns a pointer
to a menu from libdbusmenu that we shouldn't delete.
This patch makes any newly created menu delete itself on closure.
It then shuffles some code so that we only call createMenu after
doing checks.
Test Plan:
Ran in compact mode, clicked menu a few times
Ran in full mode, clicked a menu a few times
Reviewers: Plasma, broulik
Reviewed By: Plasma, broulik
Subscribers: plasma-devel
Tags: Plasma
Differential Revision: https://phabricator.kde.org/D4393