Bug 421082

Summary: Copy paste bug in KisWindowLayoutResource.cpp
Product: [Applications] krita Reporter: Rafał Mikrut <mikrutrafal>
Component: GeneralAssignee: Tiar <tamtamy.tymona>
Status: RESOLVED FIXED    
Severity: normal CC: halla, tamtamy.tymona
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Rafał Mikrut 2020-05-05 20:39:06 UTC
```
            if (aRect.y() == bRect.y()) return aRect.x() < bRect.x();
            return (aRect.y() < aRect.y());
        });


```



https://invent.kde.org/kde/krita/-/blob/master/libs/ui/KisWindowLayoutResource.cpp#L212
Comment 1 Halla Rempt 2021-02-19 16:24:12 UTC
Sorry for the late reply, but I'm not completely sure I see the copy/paste error? The layout of the code is atrocious, but I think it does what it should do?
Comment 2 Tiar 2021-02-19 20:19:41 UTC
See the a/b prefixes; in the last line it checks "aRect.y() < aRect.y()" which is of course always false. It probably should be `b` in the second one, but it would be good to check in context.

Btw the line number is 200 now: https://invent.kde.org/graphics/krita/-/blob/master/libs/ui/KisWindowLayoutResource.cpp#L200
Comment 3 Tiar 2021-08-22 22:50:21 UTC
Git commit 77533803826b91afc573b9d249307391c4120902 by Agata Cacko.
Committed on 22/08/2021 at 22:49.
Pushed by tymond into branch 'master'.

Fix typo in WindowLayoutResource sort screens lambda

Before this commit, if the screens had different X values,
the return value would be always false because the lambda
checked aRect.y() < aRect.y() which can never be true since
it's the same value on both sides.

This commit fixes it by replacing one of them with bRect.y().
The direction is consistent with the previous line.

M  +1    -1    libs/ui/KisWindowLayoutResource.cpp

https://invent.kde.org/graphics/krita/commit/77533803826b91afc573b9d249307391c4120902
Comment 4 Halla Rempt 2021-08-23 08:57:41 UTC
Git commit 09637ff85051abb251df766a8c598691fe5464d1 by Halla Rempt, on behalf of Agata Cacko.
Committed on 23/08/2021 at 08:57.
Pushed by rempt into branch 'krita/5.0'.

Fix typo in WindowLayoutResource sort screens lambda

Before this commit, if the screens had different X values,
the return value would be always false because the lambda
checked aRect.y() < aRect.y() which can never be true since
it's the same value on both sides.

This commit fixes it by replacing one of them with bRect.y().
The direction is consistent with the previous line.
(cherry picked from commit 77533803826b91afc573b9d249307391c4120902)

M  +1    -1    libs/ui/KisWindowLayoutResource.cpp

https://invent.kde.org/graphics/krita/commit/09637ff85051abb251df766a8c598691fe5464d1