Board index » delphi » TCustomTabControl (TPageControl) bug??

TCustomTabControl (TPageControl) bug??

I noticed that each time I ran an application that used the Page Control, I
would receive a leak (user object) that turned out to be a window left
undestroyed.  As it turns out, the WindowHandle was being set to 0 so later,
the window did not get destroyed.  Delphi 4 did not have this problem as
witnessed below:

// DELPHI 4 - COMCTRLS.PAS - WORKS FINE
procedure TCustomTabControl.WMDestroy(var Message: TWMDestroy);
var
  FocusHandle: HWnd;
begin
  FocusHandle := GetFocus;
  if (FocusHandle <> 0) and ((FocusHandle = Handle) or
    IsChild(Handle, FocusHandle)) then
    Windows.SetFocus(0);
  inherited;
end;

// DELPHI 5 - COMCTRLS.PAS - LEAKS A WINDOW
procedure TCustomTabControl.WMDestroy(var Message: TWMDestroy);
var
  FocusHandle: HWnd;
begin
  if (FTabs <> nil) and (FTabs.Count > 0) then
  begin
    FSaveTabs := TStringList.Create;
    FSaveTabs.Assign(FTabs);
    FSaveTabIndex := GetTabIndex;
  end;
  FocusHandle := GetFocus;
  if (FocusHandle <> 0) and ((FocusHandle = Handle) or
    IsChild(Handle, FocusHandle)) then
    Windows.SetFocus(0);
  inherited;
  // USER OBJECT LEAK - WINDOW IS NEVER DELETED WITHOUT THE NEXT
  // LINE COMMENTED OUT.  WHY IS THIS NEXT LINE EVEN THERE??
  // WindowHandle := 0;
end;

Comments???

 

Re:TCustomTabControl (TPageControl) bug??


CAN I GET AN ANSWER FROM SOMEONE ON THIS??

Guys, it is time to release an update to Delphi 5!  Why are trying to
release a commercial product and we are down to dealing with Delphi's bugs,
leaks, and IDE problems.  This is getting old!!  Our team is already
discussing doing the next version in some other language due to so many
Delphi problems.  I mean, when you can't even run without the IDE blowing up
over time, then something needs to be done.  In addition, why is Delphi such
a memory pig??  70 MB of ram (per the task manager)?  Come on!!  I've been
using Delphi since version 3 but I have almost had it with this version.

Quote
"Brad Greenway" <bgreen...@medevolve.com> wrote in message

news:87uulc$cij13@bornews.borland.com...
Quote
> I noticed that each time I ran an application that used the Page Control,
I
> would receive a leak (user object) that turned out to be a window left
> undestroyed.  As it turns out, the WindowHandle was being set to 0 so
later,
> the window did not get destroyed.  Delphi 4 did not have this problem as
> witnessed below:

> // DELPHI 4 - COMCTRLS.PAS - WORKS FINE
> procedure TCustomTabControl.WMDestroy(var Message: TWMDestroy);
> var
>   FocusHandle: HWnd;
> begin
>   FocusHandle := GetFocus;
>   if (FocusHandle <> 0) and ((FocusHandle = Handle) or
>     IsChild(Handle, FocusHandle)) then
>     Windows.SetFocus(0);
>   inherited;
> end;

> // DELPHI 5 - COMCTRLS.PAS - LEAKS A WINDOW
> procedure TCustomTabControl.WMDestroy(var Message: TWMDestroy);
> var
>   FocusHandle: HWnd;
> begin
>   if (FTabs <> nil) and (FTabs.Count > 0) then
>   begin
>     FSaveTabs := TStringList.Create;
>     FSaveTabs.Assign(FTabs);
>     FSaveTabIndex := GetTabIndex;
>   end;
>   FocusHandle := GetFocus;
>   if (FocusHandle <> 0) and ((FocusHandle = Handle) or
>     IsChild(Handle, FocusHandle)) then
>     Windows.SetFocus(0);
>   inherited;
>   // USER OBJECT LEAK - WINDOW IS NEVER DELETED WITHOUT THE NEXT
>   // LINE COMMENTED OUT.  WHY IS THIS NEXT LINE EVEN THERE??
>   // WindowHandle := 0;
> end;

> Comments???

Other Threads