Ticket #4600 (closed defect: fixed)
Filter Segmentation fault
Reported by: | mikzyth | Owned by: | andrew_b |
---|---|---|---|
Priority: | major | Milestone: | 4.8.33 |
Component: | mc-core | Version: | 4.8.32 |
Keywords: | filter, segv, segfault | Cc: | |
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master |
Description
If "Filter..." is set within / directory and it results to an empty panel (i.e. filter doesn't match anything - "files only" should be unchecked), mc causes a Segmentation Fault.
Attachments
Change History
comment:2 Changed 2 months ago by andrew_b
- Owner set to andrew_b
- Status changed from new to accepted
comment:3 Changed 2 months ago by andrew_b
- Branch state changed from no branch to on review
Branch: 4600_filter_segfault
Initial changeset:1ac839d20c2a277d54aa00286b69f61ffeaec929
comment:4 follow-up: ↓ 6 Changed 2 months ago by zaytsev
Hmmm, maybe some extra checks too much? I get following warnings:
../../../src/filemanager/panel.c:2333:77: warning: code will never be executed [-Wunreachable-code] 2333 | if (panel->dir.len == 0 || panel->current < 0 || (panel->current = 0 && panel->top == 0)) | ^~~~~ ../../../src/filemanager/panel.c:2333:72: note: silence by adding parentheses to mark code as explicitly dead 2333 | if (panel->dir.len == 0 || panel->current < 0 || (panel->current = 0 && panel->top == 0)) | ^ | /* DISABLES CODE */ ( )
comment:5 Changed 2 months ago by zaytsev
I pushed a fixup to remove copy & paste code, what do you think?
comment:7 Changed 2 months ago by zaytsev
- Votes for changeset set to zaytsev
- Branch state changed from on review to approved
But why first introduce duplicate code, and then remove it in cleanup? Please keep it if you agree with the code, it relates to this branch, and makes it harder to review otherwise.
comment:8 Changed 2 months ago by andrew_b
- Status changed from accepted to testing
- Votes for changeset changed from zaytsev to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
I kept the code duplication removal, but in another way.
Merged to master: [b46e813120af1da0aa3afb8e983630dbc6a9471f].
git log --oneline 65fee2daf..b46e81312
comment:10 Changed 2 months ago by zaytsev
Thank you! Your way is better.
comment:11 Changed 2 months ago by mikzyth
Thank you for your work on Midnight Commander and quick fix!