Merged revision(s) 61064 #09945b4668, 61113 #a897a24acc, 61223 #298236df33, 61621 #1dec469350, 61624 #b915700854 from trunk:

LCL: Use "try finally" block for function DefaultInputDialog. Issue #35451, patch from Serge Anvarov.
........
LCL-Win32: Add support for ofForceShowHidden flag in dialog options. Issue #35452, patch from Serge Anvarov.
........
Patch from jmpessoa for IDE crash when closing some forms (highly visible for LAMW)
........
LCL-GTK2: Use libappindicator3 for System Tray Icon. Issue #35723, patch from David.
........
LCL: Fix a memory leak in TImageList.GetIcon. Issue #35684, patch from BrunoK.
........

git-svn-id: branches/fixes_2_0@61634 -
This commit is contained in:
martin 2019-07-27 15:35:44 +00:00
parent 8f6c6395fb
commit 351d1ed8a2
5 changed files with 19 additions and 20 deletions

View File

@ -1345,6 +1345,7 @@ var
LPageCtrl: TModulePageControl; LPageCtrl: TModulePageControl;
begin begin
Result := nil; Result := nil;
Application.ProcessMessages;
if (FormEditingHook = nil) or (GlobalDesignHook = nil) then if (FormEditingHook = nil) or (GlobalDesignHook = nil) then
Exit; Exit;
LForm := FormEditingHook.GetDesignerForm(GlobalDesignHook.LookupRoot); LForm := FormEditingHook.GetDesignerForm(GlobalDesignHook.LookupRoot);

View File

@ -565,8 +565,8 @@ begin
GetRawImage(Index, RawImg); GetRawImage(Index, RawImg);
RawImg.PerformEffect(AEffect, True); RawImg.PerformEffect(AEffect, True);
FillChar(IconInfo, sizeof(TIconInfo), 0);
IconInfo.fIcon := True; IconInfo.fIcon := True;
IconInfo.hbmMask := 0;
if not CreateCompatibleBitmaps(RawImg, IconInfo.hbmColor, IconInfo.hbmMask, True) if not CreateCompatibleBitmaps(RawImg, IconInfo.hbmColor, IconInfo.hbmMask, True)
then begin then begin
// bummer, the widgetset doesn't support our 32bit format, try device // bummer, the widgetset doesn't support our 32bit format, try device
@ -580,6 +580,10 @@ begin
ListImg.Free; ListImg.Free;
end; end;
Image.Handle := CreateIconIndirect(@IconInfo); Image.Handle := CreateIconIndirect(@IconInfo);
if IconInfo.hbmColor<>0 then
DeleteObject(IconInfo.hbmColor);
if IconInfo.hbmMask<>0 then
DeleteObject(IconInfo.hbmMask);
RawImg.FreeData; RawImg.FreeData;
end; end;

View File

@ -33,7 +33,7 @@ begin
Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowInputDialog'){$ENDIF}; Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowInputDialog'){$ENDIF};
Form.CreateNew(nil, 0); Form.CreateNew(nil, 0);
with Form do with Form do
begin try
PopupMode := pmAuto; PopupMode := pmAuto;
BorderStyle := bsDialog; BorderStyle := bsDialog;
Caption := InputCaption; Caption := InputCaption;
@ -95,6 +95,7 @@ begin
Value := Edit.Text; Value := Edit.Text;
Result := True; Result := True;
end; end;
finally
Form.Free; Form.Free;
end; end;
end; end;

View File

@ -12,10 +12,12 @@ uses
Classes, SysUtils, dynlibs, Classes, SysUtils, dynlibs,
Graphics, Controls, Forms, ExtCtrls, WSExtCtrls, LCLType, LazUTF8; Graphics, Controls, Forms, ExtCtrls, WSExtCtrls, LCLType, LazUTF8;
{ Very minor changes suggested May 2018 so that - { Changed priority, now use libappindicator_3 if available. ~_3 is, nominally
1. Tries a later version of libappindicator library if old one not present a Unity thing but Ubuntu and several other distros ship it (and support it) with
2. Now defaults to try and use this unit if above lib is present. Gnome desktops.
3. Still resorts to System Tray model if all else fails.
As of U19.04, libappindicator_1, even if present, does not seem to work.
DRB DRB
} }
@ -49,14 +51,13 @@ type
class function GetPosition(const {%H-}ATrayIcon: TCustomTrayIcon): TPoint; override; class function GetPosition(const {%H-}ATrayIcon: TCustomTrayIcon): TPoint; override;
end; end;
{ UnityAppIndicatorInit returns true if appindicator libraries can be loaded } { UnityAppIndicatorInit returns true if libappindicator_3 library can be loaded }
function UnityAppIndicatorInit: Boolean; function UnityAppIndicatorInit: Boolean;
implementation implementation
const const
libappindicator_1 = 'libappindicator.so.1';
libappindicator_3 = 'libappindicator3.so.1'; libappindicator_3 = 'libappindicator3.so.1';
{const {const
@ -266,20 +267,11 @@ begin
if Loaded then if Loaded then
Exit(Initialized); Exit(Initialized);
Loaded:= True; Loaded:= True;
{ if GetEnvironmentVariableUTF8('XDG_CURRENT_DESKTOP') <> 'Unity' then
begin
Initialized := False;
Exit;
end; }
if Initialized then if Initialized then
Exit(True); Exit(True);
// we'll reject if _3 not present or if both present, accept if ONLY _3 is present.
Module := LoadLibrary(libappindicator_1);
if Module <> 0 then // if _1 present, will probably work with old SystemTray
exit; // and may not work with this Unit. So let SystemTray do it.
Module := LoadLibrary(libappindicator_3); // thats the one we want here. Module := LoadLibrary(libappindicator_3); // thats the one we want here.
if Module = 0 then // no libappindicator .... if Module = 0 then // no libappindicator_3
Exit; // hope SystemTray can help you .... Exit; // hope libappindicator_1 can help you ....
Result := Result :=
TryLoad('app_indicator_get_type', @app_indicator_get_type) and TryLoad('app_indicator_get_type', @app_indicator_get_type) and
TryLoad('app_indicator_new', @app_indicator_new) and TryLoad('app_indicator_new', @app_indicator_new) and

View File

@ -605,6 +605,7 @@ function CreateFileDialogHandle(AOpenDialog: TOpenDialog): THandle;
if ofShareAware in Options then Result := Result or OFN_SHAREAWARE; if ofShareAware in Options then Result := Result or OFN_SHAREAWARE;
if ofShowHelp in Options then Result := Result or OFN_SHOWHELP; if ofShowHelp in Options then Result := Result or OFN_SHOWHELP;
if ofDontAddToRecent in Options then Result := Result or OFN_DONTADDTORECENT; if ofDontAddToRecent in Options then Result := Result or OFN_DONTADDTORECENT;
if ofForceShowHidden in Options then Result := Result or OFN_FORCESHOWHIDDEN;
end; end;
procedure ReplacePipe(var AFilter:string); procedure ReplacePipe(var AFilter:string);
@ -820,7 +821,6 @@ FOS_FORCEFILESYSTEM
FOS_ALLNONSTORAGEITEMS FOS_ALLNONSTORAGEITEMS
FOS_HIDEMRUPLACES FOS_HIDEMRUPLACES
FOS_HIDEPINNEDPLACES FOS_HIDEPINNEDPLACES
FOS_DONTADDTORECENT
FOS_DEFAULTNOMINIMODE FOS_DEFAULTNOMINIMODE
FOS_FORCEPREVIEWPANEON} FOS_FORCEPREVIEWPANEON}
@ -840,6 +840,7 @@ begin
if ofShareAware in Options then Result := Result or FOS_SHAREAWARE; if ofShareAware in Options then Result := Result or FOS_SHAREAWARE;
if ofDontAddToRecent in Options then Result := Result or FOS_DONTADDTORECENT; if ofDontAddToRecent in Options then Result := Result or FOS_DONTADDTORECENT;
if SelectFolder then Result := Result or FOS_PICKFOLDERS; if SelectFolder then Result := Result or FOS_PICKFOLDERS;
if ofForceShowHidden in Options then Result := Result or FOS_FORCESHOWHIDDEN;
{ unavailable options: { unavailable options:
ofHideReadOnly ofHideReadOnly
ofEnableSizing ofEnableSizing