[FarGroup/FarManager] master: gh-854: Windows 10 32-bit crash. (45384f584)

2 views
Skip to first unread message

farg...@farmanager.com

unread,
Jul 8, 2024, 6:00:51 PM (9 days ago) Jul 8
to farco...@googlegroups.com
Repository : https://github.com/FarGroup/FarManager
On branch : master
Link : https://github.com/FarGroup/FarManager/commit/45384f58421d9f403fd0d6ba2e7b98b4c41f68d5

>---------------------------------------------------------------

commit 45384f58421d9f403fd0d6ba2e7b98b4c41f68d5
Author: Alex Alabuzhev <alab...@gmail.com>
Date: Mon Jul 8 22:56:23 2024 +0100

gh-854: Windows 10 32-bit crash.

A relatively large value of Layout.WidthDecrement, persisted into the config,
could cause havoc after rerunning with a smaller window size


>---------------------------------------------------------------

45384f58421d9f403fd0d6ba2e7b98b4c41f68d5
far/changelog | 7 +++++++
far/filepanels.cpp | 11 ++---------
far/vbuild.m4 | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/far/changelog b/far/changelog
index 9826a9498..a712c4169 100644
--- a/far/changelog
+++ b/far/changelog
@@ -1,3 +1,10 @@
+--------------------------------------------------------------------------------
+drkns 2024-07-08 22:55:36+01:00 - build 6345
+
+1. gh-854: Windows 10 32-bit crash.
+ A relatively large value of Layout.WidthDecrement, persisted into the config,
+ could cause havoc after rerunning with a smaller window size.
+
--------------------------------------------------------------------------------
drkns 2024-06-26 18:12:34+01:00 - build 6344

diff --git a/far/filepanels.cpp b/far/filepanels.cpp
index 9d0230c05..b785f37b8 100644
--- a/far/filepanels.cpp
+++ b/far/filepanels.cpp
@@ -222,15 +222,8 @@ void FilePanels::Init()

void FilePanels::SetPanelPositions(bool LeftFullScreen, bool RightFullScreen) const
{
- if (const auto MaxWidth = ScrX / 2; MaxWidth > 10)
- {
- if (Global->Opt->WidthDecrement < -MaxWidth)
- Global->Opt->WidthDecrement = -MaxWidth;
-
- if (Global->Opt->WidthDecrement > MaxWidth)
- Global->Opt->WidthDecrement = MaxWidth;
- }
-
+ const auto AbsMaxWidthDecrement = std::max(0ll, ScrX / 2 - 10ll);
+ Global->Opt->WidthDecrement = std::max(-AbsMaxWidthDecrement, std::min(Global->Opt->WidthDecrement.Get(), AbsMaxWidthDecrement));
Global->Opt->LeftHeightDecrement = std::max(0ll, std::min(Global->Opt->LeftHeightDecrement.Get(), ScrY - 7ll));
Global->Opt->RightHeightDecrement = std::max(0ll, std::min(Global->Opt->RightHeightDecrement.Get(), ScrY - 7ll));

diff --git a/far/vbuild.m4 b/far/vbuild.m4
index 2bf3c0b36..d100d6aa3 100644
--- a/far/vbuild.m4
+++ b/far/vbuild.m4
@@ -1 +1 @@
-6344
+6345


Reply all
Reply to author
Forward
0 new messages