View Issue Details

IDProjectCategoryView StatusLast Update
0001771JEDI VCL00 JVCL Componentspublic2004-05-14 11:40
ReportercstergAssigned Touser72 
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001771: TJvHttpGrabber: syncrhonized removal code causes events to be called from within internal thread
DescriptionFrom version 2.0 of jvcl, there were some changes in the TJvHttpGrabber component (added some critical sections) in the Execute method which does the actual work. Unfortunately, all the methods that are calling events (e.g. the Ended method) which were used to be in Synchronized clauses, are now removed. Thus, all events that occur in the Execute method (and the caller is expecting them to occur within the main VCL thread) are actually fired from within the context of the THpptThread!!! This breaks everything!!!
Please, see what can be done because the component is useless like that.
TagsNo tags attached.



2004-05-14 04:32


This component is deprecated. Use TJvUrlListGrabber instead. If you have a suggested implementation change for TJvHttpGrabber, attach it to this report and we will have a look.


2004-05-14 04:57

reporter   ~0004267

Thank you for the info.
Looking at the new class JvUrlListGrabber, in the Execute method of TJvHttpUrlGrabberThread class I notice:

hHostConnection := InternetConnect(hSession, PChar(HostName), INTERNET_DEFAULT_HTTP_PORT,
        Username, Password, INTERNET_SERVICE_HTTP, 0, DWORD(Self));
      if hHostConnection = nil then
        dwIndex := 0;
        dwBufLen := 1024;
        GetMem(Buffer, dwBufLen);
        InternetGetLastResponseInfo(dwIndex, Buffer, dwBufLen);
        FErrorText := Buffer;
>>> Error;

>>>Error missing Synchronize

 while (dwBytesRead > 0) and not Terminated and FContinue do
          if not InternetReadFile(hDownload, @Buf, SizeOf(Buf), dwBytesRead) then
            dwBytesRead := 0
            Inc(dwTotalBytes, dwBytesRead);
            Grabber.FBytesRead := dwTotalBytes;
            Grabber.FStream.Write(Buf, dwBytesRead);
>>> DoProgress;
>>>DoProgress missing Synchronize

>>>if Buffer <> nil then
>>> FreeMem(Buffer);
From previous code, Buffer may have been freed but not pointing to nil, so this code may free the same buffer twice (I am not sure that the FreeMem, apart from freeing memory, set the pointer to nil also).

Just some fast checks


2004-05-14 11:40


Thanks for the JvURLGrabber fixes. Updated in CVS.

Issue History

Date Modified Username Field Change
2004-05-14 00:35 csterg New Issue
2004-05-14 04:32 user72 Note Added: 0004262
2004-05-14 04:38 user72 Status new => acknowledged
2004-05-14 04:57 csterg Note Added: 0004267
2004-05-14 11:40 user72 Status acknowledged => resolved
2004-05-14 11:40 user72 Resolution open => fixed
2004-05-14 11:40 user72 Assigned To => user72
2004-05-14 11:40 user72 Note Added: 0004281