autosave problems, using savehtmlex ...

General TRichView support forum. Please post your questions here
Post Reply
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

autosave problems, using savehtmlex ...

Post by Stef »

hi Sergey,

I automatically save an RVE every 100 seconds, using saveHTMLex. Now when typing very fast (during autosave) the programs hangs itself completely (100% cpu time and not responding).
I'm not sure the problem is caused by RVE, but if I remove the saveHTMLex, there's no problem.

To narrow the search for the cause, I would like to block the user keyboard input, is there a property or method to accomplish that ?

And in general, could there be a problem to be expected, while modifying the RVE during a saveHTMLex ?

I often find solutions, just after telling someone else about my problem ...
... so I just found out, that when I encapsulate the saveHTMLex in beginupdate/endupdate the problem seems to be solved.
Is that the correct way to solve the problem ??

thanks,
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you use timer or thread?
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

I use a timer (never used a thread)
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

hello Sergey,

do you have already any thoughts about this issue ?

thanks,
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I do not know why it happened.
Timer calling SaveHTMLEx must not cause problems.
For blocking editing, you can assign ReadOnly := True
(probably, it is required to set ReadOnly for all inplace editors, if they are active)
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

hi Sergey,
Although the occurrence is reduced significantly,
it's still not completeley vanished.
I ran the program in the Delphi IDE, and pressed PAUSE when the programs hangs. In first instance the program always stops in tGIFimage, probably busy with an animated image which is showed whenever a richview file is saved.
After removing the animated image, the program hangs always in RVThread.pas, in the while-loop shown below?
Do you have any idea what's causing tis behaviour ?
or suggestions how I can trace and / or prevent the effect ?

thanks,
Stef Mientki

procedure TRVWordEnumThread.Stop(ResetNexts: Boolean);
{$IFNDEF RICHVIEWDEF6}
var Msg: TMsg;
{$ENDIF}
begin
if (StopWorking=3) then
exit;
if ResetNexts then begin
NextRVData := nil;
NextItemNo := -1;
NextOffs := -1;
end;
if Suspended then
exit;
StopWorking := 1;
if not Delaying then begin
Priority := tpNormal;
while (StopWorking=1) and not Suspended do
{$IFDEF RICHVIEWDEF6}CheckSynchronize;{$ELSE}
if PeekMessage(Msg, 0, $8FFF, $8FFF, PM_REMOVE) then
DispatchMessage(Msg);
{$ENDIF};
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

some more information: it has nothing todo with savehtmlex.

The program just hangs, when typing very fast.
It seem to happen more often, when you edit in the middle of a document,
compared to editing at the end of the document.
I'm using 1.9.6, and I didn't see any related problems solved in the newer releases (unless it's one of those "nameless major fixes" ;-)

cheers,
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Please update to 1.9.24, very probably, this problem is solved
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

thanks Sergey,

I updated to 1.9.24 ,....
... but the result is even worse :-(
The program hangs much faster,
sometimes at the point mentioned in my previous message,
sometimes at the point below.
I checked on 4 PC's, and at some PC's the problem can be generated faster then on other PC's. The PC's where it occures the fastest, are the fastest PC's, but these PC's have a small (32MB) video card on board.
Any more suggestions ?

thanks,
Stef Mientki


(Classes.pas)
function CheckSynchronize(Timeout: Integer = 0): Boolean;
var
SyncProc: PSyncProc;
LocalSyncList: TList;
begin
if GetCurrentThreadID <> MainThreadID then
raise EThread.CreateResFmt(@SCheckSynchronizeError, [GetCurrentThreadID]);
if Timeout > 0 then
WaitForSyncEvent(Timeout)
else
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Does it happen in the specific project, or in different projects?
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

(un)fortunately ;-) I've worked for the past few years on just 1 (huge) application that uses RVE.
From about 10 users I know they have never seen this problem,
I now have one user (who is typing very fast) that reported the problem. From what we can remember, the problem occurred for the first time half a year ago, probably when I updated to 1.9.6, when I implemented spell checking, I Spell, (and a lot of other things not related to RVE).

Sergey, from your question, I assume that you until now never heard of this problem and don't have an idea if it's caused by RVE and where it's caused.
Because of the size of my program, I can also not garantee that it's caused by RVE, but as far as I can see, nothing special happens in my program (although deleting the animated image did influence the bahaviour).

Does it help if I try to make a small program, trying to get the same problem ?

cheers,
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, this problem was not reported.
I am afraid there is a conflict with some code in your application :(
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

I am afraid there is a conflict with some code in your application :(
I guess that's true, but who's to blame ? ;-)

I'll see if can make a small application,
revealing the problem,
I'll let you know my findings.

thanks,
Stef
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

FOUND IT ;-)

But no explanantion:

This hangs the process:

Code: Select all

procedure Tform_rve_edit.RVESpellingCheck(Sender: TCustomRichView;
  const AWord: String; StyleNo: Integer; var Misspelled: Boolean);
(*******************************************************************************
*******************************************************************************)
begin
  misspelled:=false;
  if SpellLanguageComboBox1.ItemIndex<=0) or
     not(Speller_available) then exit;
end;
this works fine (although I've no response from my fastest user ;-)

Code: Select all

procedure Tform_rve_edit.RVESpellingCheck(Sender: TCustomRichView;
  const AWord: String; StyleNo: Integer; var Misspelled: Boolean);
(*******************************************************************************
*******************************************************************************)
begin
  misspelled:=false;
  if (Spell_language<=0) or
     not(Speller_available) then exit;
end;
The combobox is a special one derived form customcombo-box,
but there's nothing special arounf "itemindex".

Any explanation ?

cheers,
Stef
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Probably calling SpellLanguageComboBox1.ItemIndex performs some operations that must not be performed in thread
Post Reply