Error on termination of an application using TRichView

General TRichView support forum. Please post your questions here
Post Reply
Eugene Kruglov
Posts: 9
Joined: Mon Jul 02, 2007 9:07 pm
Location: Perm, Russia

Error on termination of an application using TRichView

Post by Eugene Kruglov »

Hi, all,

Does anyone know what may happen in application that uses an array of dynamically created/destroyed TRichViewEdits? While a program is running, everything is OK but on termination the following error occurs (the information is derived using JCL Debugger). Also used are TRvaControlPanel, TRichViewActions, TRVPrint.

This error is transient, its conditions are unknown :(

09.10.2007 14:45:15 Exception EAccessViolation occured at address 00000000
Message: Access violation at address 00000000. Read of address 00000000
Call stack:
[00548247] CRVData.TCustomRVData.Clear (Line 1693, "CRVData.pas")
[0051E415] CRVFData.TCustomRVFormattedData.Clear (Line 774, "CRVFData.pas")

With hope, Eugene
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

A guess, may be stupid: may you create RichViews dynamically passing some form as an Owner parameter. When this form is freed, it frees all its controls, including these RichViews. When, in some other place, you free all RichViews in your array, and the error occurs.
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

Just a suggestion. When an item (especially a component) has been removed without formatting TRichView, AV usually occurs. On form destroy event, I put rv.clear and rv.format. It did not cause AV anymore.

Hope this may come in handy.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

When an item (especially a component) has been removed without formatting TRichView, AV usually occurs
It should not happen.
Eugene Kruglov
Posts: 9
Joined: Mon Jul 02, 2007 9:07 pm
Location: Perm, Russia

Post by Eugene Kruglov »

shmp wrote:On form destroy event, I put rv.clear and rv.format. It did not cause AV anymore.
I did it, but the error persists... Then I've added the try.. except block in 'CRVData.pas' in place where the error comes from, and all was finished. The benefit from doing this is elimination of annoying OS's window which offers to send to Microsoft a report about an error :) But this error however occurs, it is visible in application's log file. What's up, I don't know.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Place a breakpoint in TRichView.Destroy. Calculate how many times it is called (may be it is called twice for the same TRichView)
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post by shmp »

My simple guess is that an item (notably a component) has an event created for it. If the item is removed but the event is still triggered, the AV is unavoidable. The clear and format doesn't help anyway. It is only a guess and the problem could be other things.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, I agree, it is highly possible that this error occurs because of code in some event. Error occurs when accessing some component on form that is already destroyed.
Eugene Kruglov
Posts: 9
Joined: Mon Jul 02, 2007 9:07 pm
Location: Perm, Russia

Post by Eugene Kruglov »

I will try your suggestions, then report... Thank you for attention!
Post Reply