Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004914 [JEDI VCL] 00 JVCL Components block always 2009-09-01 13:29 2009-09-14 23:01
Reporter wesson View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0004914: [TJvTimerThread] Exception raised when enabling timer thread - solution here
Description in JvThreadTimer.pas, the constructor of TJvTimerThread create a suspended thread, and at the last line of the constructor, the thread is started

(Line 150) :
  {$IFDEF COMPILER14_UP}Start{$ELSE}Resume{$ENDIF COMPILER14_UP};
end;

However, since D2010 all threads are created in suspended state, but there is a "AfterConstruction" method called which start the thread if it was not created in a suspended state.

This change was probably made to make sure that all the constructor will be executed before the thread is really starting. However, this imply that if a thread is created suspended, the "start" method can''t be called from within the constructor, which is the case in the TJvTimerThread object

My Solution is to conditionnally implement an AfterConstruction method that does nothing, which will prevent the start method to be called twice.
Additional Information Attached patch file does it
Tags JVCL
Attached Files ? file icon TJvTimerThread_D2010_Fix.patch [^] (1,178 bytes) 2009-09-01 13:29
7z file icon TJvTimerthreadIssue.7z [^] (3,515 bytes) 2009-09-10 01:07

- Relationships

-  Notes
(0016058)
AlexB (reporter)
2009-09-08 11:50

> since D2010 all threads are created in suspended state,
> but there is a "AfterConstruction" method called which start
> the thread if it was not created in a suspended state.

For your information: v.2007 has the same architecture.
(0016073)
obones (administrator)
2009-09-09 19:39

Hello,

We would really like to have the zipped sources of a sample application showing this.
(0016082)
wesson (reporter)
2009-09-10 01:09

Here you have:

TJvTimerThreadIssue.7z (sevenzip compressed)

Compile, Run, see the crash

Patch, Run, no longer crashes
(0016101)
AHUser (developer)
2009-09-14 23:01

Fixed in SVN.
The thread is now created with CreateSuspended=False and the reason for the old implementation, setting the thread priority, is deferred to the Execute() method. That way we are compatible with the old and new TThread class.

- Issue History
Date Modified Username Field Change
2009-09-01 13:29 wesson New Issue
2009-09-01 13:29 wesson File Added: TJvTimerThread_D2010_Fix.patch
2009-09-01 13:31 wesson Tag Attached: JVCL
2009-09-08 11:50 AlexB Note Added: 0016058
2009-09-09 19:39 obones Note Added: 0016073
2009-09-09 19:39 obones Status new => feedback
2009-09-10 01:07 wesson File Added: TJvTimerthreadIssue.7z
2009-09-10 01:09 wesson Note Added: 0016082
2009-09-14 23:01 AHUser Note Added: 0016101
2009-09-14 23:01 AHUser Status feedback => resolved
2009-09-14 23:01 AHUser Fixed in Version => Daily / SVN
2009-09-14 23:01 AHUser Resolution open => fixed
2009-09-14 23:01 AHUser Assigned To => AHUser


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker