fixed Criticalsection from Vincent

git-svn-id: trunk@4360 -
This commit is contained in:
mattias 2003-07-03 08:05:53 +00:00
parent e6458fb8da
commit 2d5486cfdc
3 changed files with 26 additions and 22 deletions

View File

@ -57,6 +57,7 @@ Var
R: TRect;
OwnerObject: TObject;
WinProcess: Boolean;
C: integer;
procedure ShowHideTabPage(NotebookHandle: HWnd; Showing: boolean);
var
NoteBook: TCustomNotebook;
@ -192,10 +193,8 @@ Begin
WM_DESTROY:
Begin
Assert(False, 'Trace:WindowProc - Got WM_DESTROY');
// The following lines cause an acces violation
// TODO: find out why.
// For C := 0 To WndList.Count - 1 Do
// EnumProps(HWND(WndList[C]), @PropEnumProc);
For C := 0 To WndList.Count - 1 Do
EnumProps(HWND(WndList[C]), @PropEnumProc);
LMessage.Msg := LM_DESTROY;
PostQuitMessage(0);
End;
@ -555,6 +554,9 @@ end;
{
$Log$
Revision 1.34 2003/07/03 08:05:53 mattias
fixed Criticalsection from Vincent
Revision 1.33 2003/07/02 20:18:28 mattias
more cleanups from Micha

View File

@ -136,18 +136,9 @@ Begin
FToolTipWindow := CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nil, WS_POPUP Or TTS_NOPREFIX Or TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, FParentWindow, HMENU(nil), HInstance, nil);
Windows.SendMessage(FParentWindow, TTM_ACTIVATE, WPARAM(True), 0);
try
FTimerWindow :=CreateWindowEx(0, @TimerClsName, nil, WS_POPUPWINDOW, 0, 0, 640, 480, 0, 0, System.HInstance, nil);
except
// Sometimes an access violation occurs, I don't know why
on E: Exception do
begin
FTimerWindow := 0;
writeln('Win32Object.Init: Failed to create a hidden window to receive timer messages');
writeln('Exception: ',E.Message);
end;
end;
FTimerWindow :=CreateWindowEx(0, @TimerClsName, nil, WS_POPUPWINDOW, 0, 0, 640, 480, 0, 0, System.HInstance, nil);
Assert(False,'Trace:FTimerWindow: ' + IntToStr(FTimerWindow));
//Init stock objects;
LogBrush.lbStyle := BS_NULL;
FStockNullBrush := CreateBrushIndirect(LogBrush);
@ -2717,6 +2708,9 @@ End;
{
$Log$
Revision 1.69 2003/07/03 08:05:53 mattias
fixed Criticalsection from Vincent
Revision 1.68 2003/07/02 20:18:28 mattias
more cleanups from Micha

View File

@ -2260,6 +2260,8 @@ Begin
Result := Windows.WindowFromPoint(Windows.POINT(Point));
End;
{We interprete CritSection as a pointer to a LPCRITICAL_SECTION structure}
Procedure TWin32Object.InitializeCriticalSection(var CritSection: TCriticalSection);
var
Crit : LPCRITICAL_SECTION;
@ -2268,8 +2270,8 @@ begin
If CritSection <> 0 then
DeleteCriticalSection(CritSection);
New(Crit);
Windows.InitializeCriticalSection(Crit^);
CritSection := Longint(Crit);
Windows.InitializeCriticalSection(Crit);
CritSection := TCriticalSection(Crit);
end;
Procedure TWin32Object.EnterCriticalSection(var CritSection: TCriticalSection);
@ -2287,11 +2289,14 @@ end;
Procedure TWin32Object.DeleteCriticalSection(var CritSection: TCriticalSection);
begin
{ An OS Compatible TCriticalSection needs to be defined}
Windows.DeleteCriticalSection(LPCRITICAL_SECTION(CritSection));
Try
Dispose(LPCRITICAL_SECTION(CritSection));
finally
CritSection := 0;
if CritSection<>0 then
begin
Windows.DeleteCriticalSection(LPCRITICAL_SECTION(CritSection));
Try
Dispose(LPCRITICAL_SECTION(CritSection));
finally
CritSection := 0;
end;
end;
end;
@ -2305,6 +2310,9 @@ end;
{ =============================================================================
$Log$
Revision 1.39 2003/07/03 08:05:53 mattias
fixed Criticalsection from Vincent
Revision 1.38 2003/07/02 20:07:29 mattias
fixed critical section from Micha