Error on Responsive Apps Delphi XE7 using Thread Unidac and TAsyncImageLoader

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
danielbudihardja
Posts: 1
Joined: Thu 20 Nov 2014 13:04

Error on Responsive Apps Delphi XE7 using Thread Unidac and TAsyncImageLoader

Post by danielbudihardja » Thu 20 Nov 2014 13:12

I want to create responsive apps using delphi xe7 which fetch mysql database from server and display in device without lagging.

below is simple example code which i wrote to display image from server which is image path fetched from my mysql database.

FYI Im using Unidac connection and for image loader im using this one http://www.fmxexpress.com/threaded-prog ... d-and-ios/.

Code: Select all

procedure TForm1.GetUserPhoto;
begin
  TThread.CreateAnonymousThread(procedure ()
  var
    queryresult:Tstringlist;
  begin
    queryresult:=TStringList.Create();
    RemoteConnQuery.SQL.Text:='<MYSQL QUERY STATEMENT>';
    RemoteConnQuery.Open;
    while not RemoteConnQuery.Eof do
    begin
      queryresult.add(RemoteConnQuery.FieldByName('userimagefilepath').AsString);
      RemoteConnQuery.Next;
    end;

    TThread.Synchronize (TThread.CurrentThread,
    procedure ()
    var
      ctr: Integer;
      profileAsyncImage:array of TAsyncImageLoader;
    begin
      for ctr := 0 to queryresult.Count-1 do
      begin
          SetLength(profileAsyncImage,ctr+1);
          profileAsyncImage[ctr]:=TAsyncImageLoader.Create(nil);
          profileAsyncImage[ctr].Parent:=layout1;
          profileAsyncImage[ctr].Width:=40;
          profileAsyncImage[ctr].Height:=40;
          profileAsyncImage[ctr].Pooled:=true;
          profileAsyncImage[ctr].Image.WrapMode:=TImageWrapMode.Stretch;
          profileAsyncImage[ctr].GetURL('http://www.domain.com/'+queryresult[ctr]+'.png');

          profileAsyncImage[ctr].Position.X:=10;
          profileAsyncImage[ctr].Position.Y:=ctr*100;
      end;
    end);
  end).Start;

end;
The problem occurs when i run this procedure for the second time call.

First time call this procedure, everything runs as expected without any error, but when I run this procedure for second time, I got so many errors for example:

"Segmentation Fault",
"EIdConnClosedGracefully with msg Connection Closed Gracefully",
"EIdReadTimeout", until
"Access Violation"


What makes this problem occurs and how to solve it?
Desperately need help on this :? :? :? :? :?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Error on Responsive Apps Delphi XE7 using Thread Unidac and TAsyncImageLoader

Post by ViktorV » Fri 21 Nov 2014 09:22

This error is not due to our products functionality, it is generated by the TAsyncImageLoader component. Please forward the question concerning this error to the component developers.

Post Reply