Welcome, Guest
Guest Settings
Help

Thread: prematurely close gives access violation


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 6 - Last Post: Apr 22, 2017 8:47 PM Last Post By: Alexandre Machado
Tom Obenschain

Posts: 50
Registered: 5/6/02
prematurely close gives access violation  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 18, 2017 7:57 AM
Hello

I have a form which closes OK upon the press of a Release button. But if I close the browser prematurely and close the App then I get an access violation. There seems to be a nil object that is being disposed. How can I find the cause? Tracing the code has only shown that the Object is a TStringList.

Thanks
Tom Obenschain
Eitan Arbel

Posts: 355
Registered: 2/24/13
Re: prematurely close gives access violation  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 18, 2017 7:27 PM   in response to: Tom Obenschain in response to: Tom Obenschain
i'm not sure i understand what does "close the browser prematurely" means,
does it happen in a specific form or in (what may look like) random?

i think there could be several reasons for that.
* i would check the code in the OnCloseSession\OnDestroy in the ServerController\UserSessionUnit\Form,
* also maybe you have a lengthy process to the DB (or not only) that is being operated and when the browser is closing - it breaks it.
* any "refreshing" operations in the OnRender of a form that are colliding with the closing browser (i'm not so sure this one can cause what you describe, but who knows... :D )
(hope my english was good enough for what i wanted to say... :D )
Tom Obenschain

Posts: 50
Registered: 5/6/02
Re: prematurely close gives access violation  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 19, 2017 1:37 AM   in response to: Eitan Arbel in response to: Eitan Arbel
Eitan Arbel wrote:
i'm not sure i understand what does "close the browser prematurely" means,

I click the upper right close icon of the browser. Then I click the close icon of the app. The program has an access violation in TIWApplication.RemoveForm.
Tom Obenschain

Posts: 50
Registered: 5/6/02
Re: prematurely close gives access violation  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 19, 2017 3:09 AM   in response to: Eitan Arbel in response to: Eitan Arbel
I used

RangesFormw := TRangesForm.Create(Application);

instead of

RangesFormw := TRangesForm.Create(WebApplication);
S. Mahaux

Posts: 32
Registered: 4/4/02
Re: prematurely close gives access violation  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 21, 2017 11:53 AM   in response to: Tom Obenschain in response to: Tom Obenschain
I wonder if
RangesFormw := TRangesForm.Create( nil );
is acceptable?
Chad Hower

Posts: 377
Registered: 3/2/07
Re: prematurely close gives access violation  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 21, 2017 1:58 PM   in response to: S. Mahaux in response to: S. Mahaux
On 4/21/2017 2:53 PM, S. Mahaux wrote:
I wonder if
RangesFormw := TRangesForm.Create( nil );
is acceptable?

If you do this, IntraWeb will not be able to manage the form for you
when the session ends and you will have memory leaks unless you clean
them up manually.
Alexandre Machado

Posts: 1,547
Registered: 8/10/13
Re: prematurely close gives access violation  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 22, 2017 8:47 PM   in response to: Tom Obenschain in response to: Tom Obenschain
Tom Obenschain wrote:
I used

RangesFormw := TRangesForm.Create(Application);

instead of

RangesFormw := TRangesForm.Create(WebApplication);

IntraWeb requires the form to be owned by WebApplication instance.

Although TRangesForm.Create(nil) might work in some cases, it is not recommended. On the other hand, TRangesForm.Create(Application) is not acceptable.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02