From fe7fdae720966314a5028d29f71b0977d87d6a4e Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 24 Oct 2024 11:00:46 +0000 Subject: [PATCH] LazMapViewer: Fix crash when changing download engines to default engine. Fix Linux compilation error. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9492 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../examples/fulldemo/configframe_with_addons.pas | 6 ++++-- components/lazmapviewer/examples/fulldemo/main.lfm | 4 ++-- components/lazmapviewer/source/mvmapviewer.pas | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/components/lazmapviewer/examples/fulldemo/configframe_with_addons.pas b/components/lazmapviewer/examples/fulldemo/configframe_with_addons.pas index 544983c1e..f7128445b 100644 --- a/components/lazmapviewer/examples/fulldemo/configframe_with_addons.pas +++ b/components/lazmapviewer/examples/fulldemo/configframe_with_addons.pas @@ -53,8 +53,10 @@ begin 3: {$IFDEF MSWINDOWS} MapView.DownloadEngine := TMvDEWin.Create(self); {$ELSE} - MapView.DownloadEngine := nil; - ShowMessage('WinInet download engine can only be used in Windows.'); + begin + MapView.DownloadEngine := nil; + ShowMessage('WinInet download engine can only be used in Windows.'); + end; {$ENDIF} 4: MapView.DownloadEngine := TMvDECache.Create(self); end; diff --git a/components/lazmapviewer/examples/fulldemo/main.lfm b/components/lazmapviewer/examples/fulldemo/main.lfm index 3a8a5d39c..036ce07b0 100644 --- a/components/lazmapviewer/examples/fulldemo/main.lfm +++ b/components/lazmapviewer/examples/fulldemo/main.lfm @@ -632,7 +632,7 @@ object MainForm: TMainForm MinSize = 8 MaxSize = 166 Title.Caption = 'Provider' - Width = 166 + Width = 154 end> Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll, goRowHighlight] RowCount = 11 @@ -643,7 +643,7 @@ object MainForm: TMainForm ColWidths = ( 30 54 - 166 + 154 ) Cells = ( 11 diff --git a/components/lazmapviewer/source/mvmapviewer.pas b/components/lazmapviewer/source/mvmapviewer.pas index fbde66073..3d2596788 100644 --- a/components/lazmapviewer/source/mvmapviewer.pas +++ b/components/lazmapviewer/source/mvmapviewer.pas @@ -842,6 +842,7 @@ implementation uses FileUtil, LazLoggerBase, Types, Math, mvJobQueue, + mvDLEFPC, {$IFDEF MSWINDOWS} mvDLEWin, {$ENDIF} @@ -2094,9 +2095,9 @@ begin Result := FDownloadEngine; end; -function TMapView.UsesDefaultdownloadEngine: Boolean; +function TMapView.UsesDefaultDownloadEngine: Boolean; begin - Result := FDownloadEngine <> FBuiltinDownloadEngine; + Result := (FDownloadEngine = nil) or (FDownloadEngine = FBuiltinDownloadEngine); end; function TMapView.GetDrawingEngine: TMvCustomDrawingEngine; @@ -2109,7 +2110,7 @@ end; function TMapView.UsesDefaultDrawingEngine: Boolean; begin - Result := FDrawingEngine <> FBuiltinDrawingEngine; + Result := (FDrawingEngine = nil) or (FDrawingEngine = FBuiltinDrawingEngine); end; function TMapView.GetDrawPreviewTiles: Boolean;