Hello, Items specific to the Qt widget set.
I've tried to understand what can cause memory corruption. My first assumption was that Qt events can be fired while Widget destroying. So I moved all event creation code to TQtWidget.AttachEvents and all event destuction code to TQtWidget.DetachEvents.
Before Widget destruction I call DetachEvents to ensure that no events will be fired during death process.
Please you dislike it then revert commit. As for
me, code became more beautiful without repeating of event attaching stuff in various units.
But this did not help with memory corruption.
While experiments I've catched exception in TQtWSCustomControl.ShowHide in this part
if not AWinControl.InheritsFrom(TCustomForm) then
TQtAbstractScrollArea(AWinControl.Handle).viewportNeeded;After replacing it with
if Widget is TQtAbstractScrollArea then
TQtAbstractScrollArea(Widget).viewportNeeded;memory corruption is gone.
So, I think such replacemennts can be done in all code where we looking at LCL component, but doing cast of TQtWidget.
I also commited TQtCaret, but disabled it work through check how this changes will affect your test (or work) applications.
ps:
I will not be available for monday morning, so fell free to revert commit if something will work wrong.
