[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [kate] [Bug 328271] Kate crash by segmentation fault while editing
From:       Dominik Haumann <dhaumann () kde ! org>
Date:       2013-12-21 14:46:11
Message-ID: bug-328271-17878-B59kG38pCG () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=328271

--- Comment #17 from Dominik Haumann <dhaumann@kde.org> ---
@Michal:

katehighlight.h:
  KateHlContext *contextNum (int n)
  {
    if (n >= 0 && n < m_contexts.size()) return m_contexts[n];
    Q_ASSERT (0);
    return m_contexts[0];
   }

With your patch, instead of passing the contents of the last item of
contextStack() to contextNum, we now pass the size()-1 of the contextStack() to
contextNum. I don't think that makes sense, does it?

(In release mode, it's optimized out, so we access m_contexts[0] even though
there are no elements. This should be a return 0 anyways, as now re return an
arbitrary value that does not really exist.

My guess is another one:
#7 0xb241cc44 in KSharedPtr (o=..., this=...) at /usr/include/ksharedptr.h:84
#8 KateDocument::defStyleNum (this=0x9aa9b30, line=126, column=9) at
part/document/katedocument.cpp:5485

Kate::TextLine is a shared pointer. And this is most probably invalid.
Therefore, I'd propose to just do a validity check as we have it almost
everywhere in the code:
  if( !tl )
    return -1;

Will commit this, let's see whether this changes anything for the 4.12.1
release.

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic