[Qt] Todays commit

Paul Ishenin ip at kmiac.ru
Thu Jul 12 08:10:15 CEST 2007


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 look at solution. If 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 ifdefs at moment.


Please 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.

--
Best regards,
Paul Ishenin.




More information about the Qt mailing list