Sign in Join

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

Mailing lists / fpc-devel / 2007-11

ShowModal / Application.Idle problem

8 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Andrey Gusev

TCustomForm.ShowModal() implementation have call to Application.Idle() after closing form, for what ??
background: My some forms idle tasks have appeal to form's visual components, so i got AV.
I use standart TApplicationProperties.OnIdle() event. I can, sure, implement closing checking myself in my forms, but, i sure, ShowModal() is erroneous to call
Application.Idle() after form closing.

Reply by email

Andrey Gusev
to Andrey Gusev

* Andrey Gusev [Fri, 16 Nov 2007 17:35:26 +0300]:

I can, sure, implement closing checking myself in my forms, but, i

sure,

ShowModal() is erroneous to call Application.Idle() after form closing.

Or, probably, TApplicationProperties component implementation erroneous
- there must form closing checked ?

Reply by email

Andrey Gusev
to Andrey Gusev: TCustomForm.ShowModal() implementation have call to Application.Idle() after closing…

* Andrey Gusev [Fri, 16 Nov 2007 17:35:26 +0300]:

Can anybody explain to me, why dynamically created forms with TApplicationProperties.OnIdle(),
incline to AV ??? With Delphi it was impeccability ! Please see attached sample. Stack backtrace included.

--------------------
first message

Show quoted text 7 lines
TCustomForm.ShowModal() implementation have call to Application.Idle() after closing form, for what ?? background: My some forms idle tasks have appeal to form's visual components, so i got AV. I use standart TApplicationProperties.OnIdle() event. I can, sure, implement closing checking myself in my forms, but, i sure,

now only: it seems

ShowModal() is erroneous to call Application.Idle() after form closing.

--------
later

Or, probably, TApplicationProperties component implementation

erroneous

- there must form closing checked ?

rather: form existence

Reply by email

Mattias Gaertner
to Andrey Gusev
Show quoted text 5 lines
* Andrey Gusev [Fri, 16 Nov 2007 17:35:26 +0300]: Can anybody explain to me, why dynamically created forms with TApplicationProperties.OnIdle(), incline to AV ???

Because the destructor was missing. I added it, so the TApplicationProperties now unset the events on destruction.

Show quoted text 8 lines
With Delphi it was impeccability ! Please see attached sample. Stack backtrace included. -------------------- first message > TCustomForm.ShowModal() implementation have call to > Application.Idle() after closing form, for what ??

You misunderstood the code: TCustomForm.ShowModal only calls Idle if *not* closing. See your backtraces: It's the normal Application that calls Idle.

Show quoted text 19 lines
> background: My some forms idle tasks have appeal to form's visual > components, so i got AV. > I use standart TApplicationProperties.OnIdle() event. > I can, sure, implement closing checking myself in my forms, but, > i sure, now only: it seems > ShowModal() is erroneous to call > Application.Idle() after form closing. -------- later > Or, probably, TApplicationProperties component implementation erroneous > - there must form closing checked ? rather: form existence

Note: TApplicationProperties should be changed to use the handler lists (e.g. AddOnIdleHandler) instead of the global events. At the moment there can only be one TApplicationProperties at a time.

Mattias

Reply by email

Andrey Gusev
to Mattias Gaertner

* Mattias Gaertner [Tue, 20 Nov 2007
01:14:27 +0100]:

Show quoted text 8 lines
On Tue, 20 Nov 2007 00:08:20 +0300 Andrey Gusev wrote: > * Andrey Gusev [Fri, 16 Nov 2007 17:35:26 +0300]: > Can anybody explain to me, why dynamically created forms with > TApplicationProperties.OnIdle(), > incline to AV ??? Because the destructor was missing. I added it, so the TApplicationProperties now unset the events on destruction.

Thanks for hint, i will try it - on my workproject, but with Delphy it was not neccessarily...

Reply by email

Mattias Gaertner
to Andrey Gusev
Show quoted text 13 lines
* Mattias Gaertner [Tue, 20 Nov 2007 01:14:27 +0100]: > On Tue, 20 Nov 2007 00:08:20 +0300 > Andrey Gusev wrote: > > * Andrey Gusev [Fri, 16 Nov 2007 17:35:26 > > +0300]: Can anybody explain to me, why dynamically created forms > > with TApplicationProperties.OnIdle(), > > incline to AV ??? > Because the destructor was missing. I added it, so the > TApplicationProperties now unset the events on destruction. Thanks for hint, i will try it - on my workproject, but with Delphy it was not neccessarily...

Maybe you misunderstood. It was a bug in the LCL, not in your application.

Mattias

Reply by email

Andrey Gusev
to Mattias Gaertner

* Mattias Gaertner [Tue, 20 Nov 2007
10:55:49 +0100]:

Show quoted text 16 lines
On Tue, 20 Nov 2007 12:40:41 +0300 Andrey Gusev wrote: > * Mattias Gaertner [Tue, 20 Nov 2007 > 01:14:27 +0100]: > > On Tue, 20 Nov 2007 00:08:20 +0300 > > Andrey Gusev wrote: > > > * Andrey Gusev [Fri, 16 Nov 2007 17:35:26 > > > +0300]: Can anybody explain to me, why dynamically created forms > > > with TApplicationProperties.OnIdle(), > > > incline to AV ??? > > Because the destructor was missing. I added it, so the > > TApplicationProperties now unset the events on destruction. > Thanks for hint, i will try it - on my workproject, > but with Delphy it was not neccessarily... Maybe you misunderstood. It was a bug in the LCL, not in your application.

I understand it now. I must lead this to mantis ?, for your statistic calculations or whatever ?

Reply by email

Mattias Gaertner
to Andrey Gusev
Show quoted text 21 lines
* Mattias Gaertner [Tue, 20 Nov 2007 10:55:49 +0100]: > On Tue, 20 Nov 2007 12:40:41 +0300 > Andrey Gusev wrote: > > * Mattias Gaertner [Tue, 20 Nov 2007 > > 01:14:27 +0100]: > > > On Tue, 20 Nov 2007 00:08:20 +0300 > > > Andrey Gusev wrote: > > > > * Andrey Gusev [Fri, 16 Nov 2007 17:35:26 > > > > +0300]: Can anybody explain to me, why dynamically created > > > > forms with TApplicationProperties.OnIdle(), > > > > incline to AV ??? > > > Because the destructor was missing. I added it, so the > > > TApplicationProperties now unset the events on destruction. > > Thanks for hint, i will try it - on my workproject, > > but with Delphy it was not neccessarily... > Maybe you misunderstood. It was a bug in the LCL, not in your > application. I understand it now. I must lead this to mantis ?, for your statistic calculations or whatever ?

Only if you opened a bug report for this.

Mattias

Reply by email