mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 07:55:59 +02:00
MG: fixed calling DestroyHandle if not HandleAllocated
git-svn-id: trunk@3352 -
This commit is contained in:
parent
093d68ba1a
commit
37611d322b
@ -364,20 +364,21 @@ end;
|
||||
|
||||
procedure TBitmap.SetHandle(Value: HBITMAP);
|
||||
begin
|
||||
if FImage.FHandle = Value then exit;
|
||||
// TODO: the properties from new bitmap
|
||||
with FImage do
|
||||
if FHandle <> Value then
|
||||
begin
|
||||
FreeContext;
|
||||
Release;
|
||||
FImage := TBitmapImage.Create;
|
||||
Reference;
|
||||
FHandle:=Value;
|
||||
FillChar(FDIB, sizeof(FDIB), 0);
|
||||
if Value <> 0 then
|
||||
GetObject(FHandle, SizeOf(FDIB), @FDIB);
|
||||
Changed(Self);
|
||||
end;
|
||||
with FImage do begin
|
||||
FreeContext;
|
||||
Release;
|
||||
end;
|
||||
FImage := TBitmapImage.Create;
|
||||
with FImage do begin
|
||||
Reference;
|
||||
FHandle:=Value;
|
||||
FillChar(FDIB, sizeof(FDIB), 0);
|
||||
if Value <> 0 then
|
||||
GetObject(FHandle, SizeOf(FDIB), @FDIB);
|
||||
Changed(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBitmap.SetMaskHandle(Value: HBITMAP);
|
||||
@ -465,6 +466,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.20 2002/09/16 15:42:17 lazarus
|
||||
MG: fixed calling DestroyHandle if not HandleAllocated
|
||||
|
||||
Revision 1.19 2002/09/13 16:58:27 lazarus
|
||||
MG: removed the 1x1 bitmap from TBitBtn
|
||||
|
||||
|
@ -34,7 +34,8 @@ begin
|
||||
// get the interface based item list
|
||||
NewStrings:= TStrings(Pointer(CNSendMessage(LM_GETITEMS, Self, nil)));
|
||||
// then delete internal list
|
||||
FItems.Free;
|
||||
if FItems<>NewStrings then
|
||||
FItems.Free;
|
||||
// and use the interface based list
|
||||
FItems:= NewStrings;
|
||||
end;
|
||||
@ -50,7 +51,9 @@ end;
|
||||
procedure TCustomComboBox.DestroyHandle;
|
||||
var NewStrings : TStrings;
|
||||
begin
|
||||
//writeln('TCustomComboBox.DestroyHandle ',Name);
|
||||
if not HandleAllocated then begin
|
||||
if (length(Name) div (length(Name) div 10000))=0 then ;
|
||||
end;
|
||||
// create an internal list for storing items internally
|
||||
NewStrings:= TStringList.Create;
|
||||
// copy from interface based list
|
||||
@ -62,7 +65,6 @@ begin
|
||||
// and use the internal list
|
||||
FItems:= NewStrings;
|
||||
|
||||
//writeln('TCustomComboBox.DestroyHandle B ',Name);
|
||||
inherited DestroyHandle;
|
||||
end;
|
||||
|
||||
@ -85,7 +87,7 @@ begin
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomComboBox.DestroyHandle
|
||||
Method: TCustomComboBox.InitializeWnd
|
||||
Params: ---
|
||||
Returns: Nothing
|
||||
|
||||
@ -455,9 +457,14 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
destructor TCustomComboBox.Destroy;
|
||||
begin
|
||||
writeln('TCustomComboBox.Destroy A ',Name);
|
||||
if HandleAllocated then DestroyHandle;
|
||||
writeln('TCustomComboBox.Destroy B ',Name);
|
||||
FItems.Free;
|
||||
FItems:=nil;
|
||||
writeln('TCustomComboBox.Destroy C ',Name);
|
||||
inherited Destroy;
|
||||
writeln('TCustomComboBox.Destroy D ',Name,' ',FItems<>nil);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -511,9 +518,8 @@ end;
|
||||
function TCustomComboBox.GetItemIndex : integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
Result:= CNSendMessage(LM_GETITEMINDEX, Self, nil)
|
||||
else
|
||||
Result:=FItemIndex;
|
||||
FItemIndex:= CNSendMessage(LM_GETITEMINDEX, Self, nil);
|
||||
Result:=FItemIndex;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -547,6 +553,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.13 2002/09/16 15:42:17 lazarus
|
||||
MG: fixed calling DestroyHandle if not HandleAllocated
|
||||
|
||||
Revision 1.12 2002/08/31 11:37:09 lazarus
|
||||
MG: fixed destroying combobox
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user