QT5Trayicon's contextMenu broken after recreating popup's handle
Original Reporter info from Mantis: Salvadorbs @salvadorbs
-
Reporter name: Salvadorbs
Original Reporter info from Mantis: Salvadorbs @salvadorbs
- Reporter name: Salvadorbs
Description:
If you re-create popup menu handle assigned to a QTrayicon (such as contextmenu), the latter will then have problems and various AVs.
(imho!) Probably with re-creating the handles, QTTrayicon's contextMenu has the old handle. By exiting the application (and thus starting to free up memory) QT tries to free the memory of the old handle, effectively going into SigSegV (it also sometimes does this during the life of the application, imho). This also causes the onClick event issue, with the popup menu being handled by QT.
Demo attached. The PopupMenu1 is assigned to Form1.PopupMenu and Trayicon1.Popup.
This issue is only on KDE distro based with QT5 (not tested on QT4)
Steps to reproduce:
Step:
1 Right click in form to open the PopupMenu1 ---> this calls method Popup and destroy & create pm1's handle
2 Close the PopupMenu1
Ok, now the Trayicon1.Popup is broken (it has the old handle of PopupMenu1). If you:
- Click on the button of the form to reload the trayicon's icon -> crash SigBUS or SigSegV
- Right click on the trayicon -> onClick event of the menuitems doesn't work (try to click menu item "ShowMessage")
Additional information:
Lazarus Trunk. KDE Neon updated. Widgetset QT5
Mantis conversion info:
- Mantis ID: 38849
- Monitored by: » @davidbannon (David)