nomacs / nomacs

nomacs is a free image viewer for windows, linux, and mac systems.
https://nomacs.org/
GNU General Public License v3.0
2k stars 151 forks source link

Always false condition in DkNoMacs.cpp #604

Closed qarmin closed 4 days ago

qarmin commented 3 years ago

https://github.com/nomacs/nomacs/blob/5377c452f4f0e1133754c118bc3d9dd4433609d9/ImageLounge/src/DkGui/DkNoMacs.cpp#L795-L806

If lock is true, then first condition is executed, but if lock is false, then second condition is omitted and never ever will be executed

scrubbbbs commented 2 months ago

Closing, condition is not always false since it is wired to a toggle action.

leejuyuu commented 1 week ago

I think it's indeed an issue. If lock is true then the first branch will be executed, whereas if lock is false then the condition of the second branch will be false as well, so the else branch will be executed. The second branch is always unused.

leejuyuu commented 1 week ago

When this feature was first introduced, it looked like this.

https://github.com/nomacs/nomacs/blob/b2e1d4242f3b8de1675eaffa8599db9bc56c139a/ImageLounge/src/DkNoMacs.cpp#L1538-L1556

Then the next commit that modified these code is

https://github.com/nomacs/nomacs/blob/9bebb48e6860b4b79f056ca1cf31c6791ab1e705/ImageLounge/src/DkGui/DkNoMacs.cpp#L1006-L1025