Конференция "KOL" » KOL3.20 BUG Report [Delphi, Windows]
 
  • dotnet20 (30.10.13 07:06) [0]
    1)procedure WndProc_LVSubitemDraw comment have some special char, can't compile in chinese windows
    2)destructor TMenu.Destroy memory leak, use FastMM4:

     if FParentMenu <> nil then
     begin
       Prnt := FParentMenu;
       Next := Prnt.RemoveSubMenu( FId );
       FParentMenu := nil;
       Prnt.FMenuItems.Remove( @ Self );
       if Next = nil then Exit;
    end;

    need changed to:

     if FParentMenu <> nil then
     begin
       Prnt := FParentMenu;
       FParentMenu := nil;
       Next := Prnt.RemoveSubMenu( FId );
       Prnt.FMenuItems.Remove( @ Self );
       if Next = nil then Exit;
    end;
  • dotnet20 (30.10.13 08:01) [1]
    a more good change:

     if FParentMenu <> nil then
     begin
       Prnt := FParentMenu;
       Next := Prnt.RemoveSubMenu( FId );
       //FParentMenu := nil;
       Prnt.FMenuItems.Remove( @ Self );
       if Next = nil then Exit; {>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
     end;

    function TMenu.RemoveSubMenu( ItemToRemove: Integer ): PMenu;
    {$IFDEF DEBUG_MENU}var OK: Boolean; {$ENDIF}
    var M: PMenu;
    begin
     Result := Items[ ItemToRemove ];
     if Result = nil then Exit; {>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
     M := Result.FParentMenu;
     if M = nil then M := @Self;
     {$IFDEF DEBUG_MENU} OK := {$ENDIF}
     RemoveMenu( M.FHandle, Result.FId, MF_BYCOMMAND );
     M.FMenuItems.Remove( Result );
     {$IFDEF DEBUG_MENU}
     if not OK then
       ShowMessage( 'Error removing menu: ' + Int2Str( GetLastError ) + ' - ' +
                    SysErrorMessage( GetLastError ) );
     {$ENDIF}
     if Count = 0 then
     begin
       Result.FParentMenu := nil;
       Result.Free;
       Result := nil;
     end;
     RedrawFormMenuBar;
    end;
  • dotnet20 (30.10.13 10:43) [2]
    final solution:

    function TMenu.RemoveSubMenu( ItemToRemove: Integer ): PMenu;
    {$IFDEF DEBUG_MENU}var OK: Boolean; {$ENDIF}
    var M: PMenu;
    begin
     Result := Items[ ItemToRemove ];
     if Result = nil then Exit; {>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
     M := Result.FParentMenu;
     if M = nil then M := @Self;
     {$IFDEF DEBUG_MENU} OK := {$ENDIF}
     RemoveMenu( M.FHandle, Result.FId, MF_BYCOMMAND );
     M.FMenuItems.Remove( Result );
     {$IFDEF DEBUG_MENU}
     if not OK then
       ShowMessage( 'Error removing menu: ' + Int2Str( GetLastError ) + ' - ' +
                    SysErrorMessage( GetLastError ) );
     {$ENDIF}
     //if Count = 0 then
     begin
       Result.FParentMenu := nil;
       Result.Free;
       Result := nil;
     end;
     RedrawFormMenuBar;
    end;
  • dotnet20 (30.10.13 10:45) [3]
    KOL 3.20 new function and procedure is not  UNICODE, i think this break 3.18's Unicode style
  • rednakse © (05.11.13 22:39) [4]
    This method solves the problem of memory leaks on destruction menu?
  • dotnet20 (06.11.13 05:34) [5]
    modify two method can solves menu meory leak
    1)destructor TMenu.Destroy
       //FParentMenu := nil;
    2)function TMenu.RemoveSubMenu( ItemToRemove: Integer ): PMenu;
    //if Count = 0 then
    begin
      Result.FParentMenu := nil;
      Result.Free;
      Result := nil;
    end;
  • rednakse © (06.11.13 20:49) [6]
    So, it's great. Thx!
 
Конференция "KOL" » KOL3.20 BUG Report [Delphi, Windows]
Есть новые Нет новых   [134427   +34][b:0][p:0]