Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-12

Deleting a control in its OnClick event can cause a SIGSEV?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

Hello,

I was having a random SIGSEV ("random" meaning it didn't happen every time) in an OnClick event, the sigsev being always on the MouseUp instruction in TControl.DoMouseUp (include/control.inc). It happened both in windows and linux.
It turns out that in the OnClick event I was calling a method that freed the control that generated the OnClick, so I supposed that was the cause of the sigsev.
Now I use Application.QueueAsyncCall to fire the method after the event has been executed and the SIGSEV seems to be gone, however, since it was random, it may still reappear, unless the above hypothesis is true. Is it possible that destroying the control was the cause of the SIGSEV?

TIA

Bye

Luca Olivetti Wetron Automation Technology http://www.wetron.es Tel. +34 935883004 Fax +34 935883007

Reply by email

Bart
to Luca Olivetti
Luca Olivetti wrote
It turns out that in the OnClick event I was calling a method that freed the control that generated the OnClick, so I supposed that was the cause of the sigsev.

Probably you are right.
Been there, done that.

Now I use Application.QueueAsyncCall to fire the method after the event

You can use Application.ReleaseComponent()
(Was offered as a solution to me when I had the same problem)

Is it possible that destroying the control was the cause of the SIGSEV?

Yes

Bart

Reply by email

Luca Olivetti
to Bart

El 31/12/14 a les 19:26, Bart ha escrit:

Show quoted text 8 lines
On 12/31/14, Luca Olivetti wrote: > It turns out that in the OnClick event I was calling a method that freed > the control that generated the OnClick, so I supposed that was the cause > of the sigsev. Probably you are right. Been there, done that.

OK, thank you

Show quoted text 5 lines
> Now I use Application.QueueAsyncCall to fire the method after the event You can use Application.ReleaseComponent() (Was offered as a solution to me when I had the same problem)

Well, I'm doing a lot of other things in the method, so QueueAsyncCall is more fitting.

> Is it possible that destroying the control was the cause of the SIGSEV? Yes

Phew, I'm relieved. You know, the system is going to go live next week. I simulated around six months worth of operating cycles in a virtual machine, but this problem appeared in the real hardware with a configuration form (which isn't going to be used much but still has to work) that never gave problems during previous testing.

Bye, and happy new year!

Luca Olivetti Wetron Automation Technology http://www.wetron.es Tel. +34 935883004 Fax +34 935883007

Reply by email