I'm developing a DataSnap server application that generates RichViews on demand. If I call the remote method on 2 clients or more at the same time I get this error "Canvas does not allow drawing".
I'm not using the same TRichview for all method calls. Every method creates its own TRichView component. The only shared component is the TRVStyle.
Are there any workaround for it? I accept a sincronized-one-thread solution.
I'm using a DataSnap Server, so the remote method are running on its own thread. To simplify the things I decided to use a Critical Section.
The code is show below:
procedure TDataSnapServer.GenerateRichView;
begin
CS.Acquire;
try
With TfrmGenerateRichView.Create(nil) do begin
DoGenerate;
Free;
End;
finally
CS.Release;
end;
end;
The Critical Section is working well, but sometimes, even when I'm running a single thread, I get the Canvas error...