Summary: | crash in folding bar after reload | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Dominik Haumann <dhaumann> |
Component: | folding | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | adrian.lungu89, dhaumann |
Priority: | VHI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Dominik Haumann
2011-09-20 16:00:23 UTC
Adrian: Can you have a look, this is definitely in the new code :-) Dominik, please attach a file on which the bug can be replicated. I tried on a .c file, but I couldn't replicate it. Thank you, Adrian Updated backtrace: #7 0xb250a185 in KateCodeFoldingNode::getStartMatching (this=0x0, endNode=0x829fcf0) at syntax/katecodefolding.cpp:148 #8 0xb250cb43 in KateCodeFoldingTree::getLineInfo (this=0x829fae8, info=0xbfdcc7fc, line=-1) at syntax/katecodefolding.cpp:972 #9 0xb2496031 in KateBuffer::lineInfo (this=0x829fa60, info=0xbfdcc7fc, line=-1) at document/katebuffer.h:187 #10 0xb248da9d in KateDocument::lineInfo (this=0x829f5b8, info=0xbfdcc7fc, line=-1) at document/katedocument.cpp:4041 #11 0xb2541f80 in KateIconBorder::mouseReleaseEvent (this=0x82a4438, e=0xbfdcce54) at view/kateviewhelpers.cpp:1490 This implies that in void KateCodeFoldingTree::getLineInfo(KateLineInfo *info, int line) the line if (m_lineMapping.contains(line) && !m_lineMapping[line].isEmpty()) { returns true, meaning that line = -1 is in the m_lineMapping QMap. Isn't this wrong? Hm, you should be able to reproduce, as said: 1. make the code folding bar visible 2. hover over it, so the blue part appears 3. press F5 (reload) 4. click (_without_ moving the mouse, i.e. no blue bar anymore!) 5. crash Reproducible with all files. The problem is that I pass -1 to lineInfo. I will fix that, but your code should be more robust here. As said, why is -1 in the line mapping at all? I have left my computer for the moment. I will come back in about an hour and take a closer look. I tried to fallow your steps, but it didn't crash. I hope i will be luckier when i come back. I'll keep you in touch with the progress. On Sep 20, 2011 6:22 PM, "Dominik Haumann" <haumann@kate-editor.org> wrote: > https://bugs.kde.org/show_bug.cgi?id=282416 > > > > > > --- Comment #5 from Dominik Haumann <haumann kate-editor org> 2011-09-20 16:22:30 --- > The problem is that I pass -1 to lineInfo. I will fix that, but your code > should be more robust here. As said, why is -1 in the line mapping at all? > > -- > Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You are on the CC list for the bug. Git commit 230bcb64e2efee87ada4505fea562ebb88bd7892 by Adrian Lungu. Committed on 20/09/2011 at 21:42. Pushed by lungu into branch 'master'. Folding bug fixed The root node was iterated in getLineInfo() method causing a crash BUG: 282416 M +2 -2 part/syntax/katecodefolding.cpp http://commits.kde.org/kate/230bcb64e2efee87ada4505fea562ebb88bd7892 It should work just fine now, Dominik. The problem was not that line = -1. The root node is placed on line -1 in order to be above all the other nodes all the time. The problem is that the root node should not be iterated in that loop because it is just a "fictive" node. The problem appeared with Kate's new highlighting look. I was testing on an older version earlier and it was working OK. :) Adrian Ok, that is great to hear and what I hoped: to fix the real thing here and not work around it by catching the case earlier. Maybe for the future: You usually develop with assumptions. In this case: "We assume "line >= 0" or so. Then a line Q_ASSERT(line >=0); // root node is line -1 should be added there or similar. In this way, a crash (in debug mode) will tell me immediately that the function is not supposed to be called with negative lines, or at least you assumed this would not be the case. Anyway, thanks for looking into this so quickly! |