View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001771 | JEDI VCL | 00 JVCL Components | public | 2004-05-14 00:35 | 2004-05-14 11:40 |
Reporter | csterg | Assigned To | user72 | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0001771: TJvHttpGrabber: syncrhonized removal code causes events to be called from within internal thread | ||||
Description | From 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. | ||||
Tags | No tags attached. | ||||
|
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. |
|
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 begin dwIndex := 0; dwBufLen := 1024; GetMem(Buffer, dwBufLen); InternetGetLastResponseInfo(dwIndex, Buffer, dwBufLen); FErrorText := Buffer; FreeMem(Buffer); >>> Error; Exit; end; >>>Error missing Synchronize while (dwBytesRead > 0) and not Terminated and FContinue do begin if not InternetReadFile(hDownload, @Buf, SizeOf(Buf), dwBytesRead) then dwBytesRead := 0 else begin Inc(dwTotalBytes, dwBytesRead); Grabber.FBytesRead := dwTotalBytes; Grabber.FStream.Write(Buf, dwBytesRead); >>> DoProgress; end; end; >>>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 |
|
Thanks for the JvURLGrabber fixes. Updated in CVS. |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-05-14 00:35 | csterg | New Issue | |
2004-05-14 04:32 |
|
Note Added: 0004262 | |
2004-05-14 04:38 |
|
Status | new => acknowledged |
2004-05-14 04:57 | csterg | Note Added: 0004267 | |
2004-05-14 11:40 |
|
Status | acknowledged => resolved |
2004-05-14 11:40 |
|
Resolution | open => fixed |
2004-05-14 11:40 |
|
Assigned To | => user72 |
2004-05-14 11:40 |
|
Note Added: 0004281 |