Bug 374013 - Crash in highlighting
Summary: Crash in highlighting
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: PHP (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-21 23:01 UTC by Francis Herne
Modified: 2021-01-16 04:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francis Herne 2016-12-21 23:01:24 UTC
Using recent git 0070511, and similar kdevplatform/kdevelop.

On opening a group of files (over sftp, in case that matters), KDevelop crashed with this trace:

(gdb) bt full
#0  0x00007f1c861cd538 in KDevelop::AbstractType::d_func() const (this=0x0) at /home/flh/projects/kdevplatform/language/duchain/types/abstracttype.h:286
#1  0x00007f1c861cceb0 in KDevelop::AbstractType::modifiers() const (this=0x0) at /home/flh/projects/kdevplatform/language/duchain/types/abstracttype.cpp:52
#2  0x00007f1c56e59c59 in HighlightingInstance::typeForDeclaration(KDevelop::Declaration*, KDevelop::DUContext*) const (this=0x7f1c3c6c0110, decl=0x7f1c3c660a60, context=0x7f1c3c0f5d30)
    at /home/flh/projects/kdev-php/phphighlighting.cpp:45
#3  0x00007f1c86251520 in KDevelop::CodeHighlightingInstance::highlightUse(KDevelop::DUContext*, int, QColor const&) (this=0x7f1c3c6c0110, context=0x7f1c3c0f5d30, index=2, color=...)
    at /home/flh/projects/kdevplatform/language/highlighting/codehighlighting.cpp:474
        type = KDevelop::HighlightingEnumContainer::ErrorVariableType
        decl = 0x7f1c3c660a60
#4  0x00007f1c862508ed in KDevelop::CodeHighlightingInstance::highlightDUChain(KDevelop::DUContext*, QHash<KDevelop::Declaration*, unsigned int>, QVector<KDevelop::Declaration*>) (this=0x7f1c3c6c0110, context=0x7f1c3c0f5d30, colorsForDeclarations=..., declarationsForColors=...) at /home/flh/projects/kdevplatform/language/highlighting/codehighlighting.cpp:301
        decl = 0x7f1c3c660a60
        color =
              {cspec = QColor::Rgb, ct = {argb = {alpha = 65535, red = 12938, green = 32146, blue = 12578, pad = 0}, ahsv = {alpha = 65535, hue = 12938, saturation = 32146, value = 12578, pad = 0}, acmyk = {alpha = 65535, cyan = 12938, magenta = 32146, yellow = 12578, black = 0}, ahsl = {alpha = 65535, hue = 12938, saturation = 32146, lightness = 12578, pad = 0}, array = {65535, 12938, 32146, 12578, 0}}}
        a = 2
        lock = {m_lock = 0x7f1c869921e0 <KDevelop::(anonymous namespace)::Q_QGS_sdDUChainPrivate::innerFunction()::holder+32>, m_locked = true, m_timeout = 0}
        top = 0x7f1c3c02de60
        takeFreeColors =
            {<QListSpecialMethods<KDevelop::Declaration*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7f1c88f48c60 <QListData::shared_null>}, d = 0x7f1c88f48c60 <QListData::shared_null>}}
        children = {d = 0x7f1c88f46e80 <QArrayData::shared_null>}
#5  0x00007f1c86250aa9 in KDevelop::CodeHighlightingInstance::highlightDUChain(KDevelop::DUContext*, QHash<KDevelop::Declaration*, unsigned int>, QVector<KDevelop::Declaration*>) (this=0x7f1c3c6c0110, context=0x7f1c3c02de60, colorsForDeclarations=..., declarationsForColors=...) at /home/flh/projects/kdevplatform/language/highlighting/codehighlighting.cpp:314
        child = 0x7f1c3c0f5d30
        _container_ = {c = {d = 0x7f1c3c0f9bd0}, i = {i = 0x7f1c3c0f9fd0}, e = {i = 0x7f1c3c0fa0e8}, control = 1}
        lock = {m_lock = 0x7f1c869921e0 <KDevelop::(anonymous namespace)::Q_QGS_sdDUChainPrivate::innerFunction()::holder+32>, m_locked = false, m_timeout = 0}
        top = 0x7f1c3c02de60
        takeFreeColors =
            {<QListSpecialMethods<KDevelop::Declaration*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7f1c88f48c60 <QListData::shared_null>}, d = 0x7f1c88f48c60 <QListData::shared_null>}}
        children = {d = 0x7f1c3c0f9bd0}
#6  0x00007f1c8624fe34 in KDevelop::CodeHighlightingInstance::highlightDUChain(KDevelop::TopDUContext*) (this=0x7f1c3c6c0110, context=0x7f1c3c02de60)
    at /home/flh/projects/kdevplatform/language/highlighting/codehighlighting.cpp:212
#7  0x00007f1c8624fb05 in KDevelop::CodeHighlighting::highlightDUChain(KDevelop::ReferencedTopDUContext) (this=0x274f170, context=...)
    at /home/flh/projects/kdevplatform/language/highlighting/codehighlighting.cpp:193
        url = {m_index = 337154}
        urlLock = {m_url = {m_index = 337154}}
        lock = {m_lock = 0x7f1c869921e0 <KDevelop::(anonymous namespace)::Q_QGS_sdDUChainPrivate::innerFunction()::holder+32>, m_locked = false, m_timeout = 0}
        revision = 0
        __PRETTY_FUNCTION__ = "virtual void KDevelop::CodeHighlighting::highlightDUChain(KDevelop::ReferencedTopDUContext)"
        instance = 0x7f1c3c6c0110
        highlighting = 0x677dcf8
#8  0x00007f1c860a08c7 in KDevelop::ParseJob::highlightDUChain() (this=0x59293a0) at /home/flh/projects/kdevplatform/language/backgroundparser/parsejob.cpp:501
#9  0x00007f1c860a060e in KDevelop::ParseJob::isUpdateRequired(KDevelop::IndexedString const&) (this=0x59293a0, languageString=...)
    at /home/flh/projects/kdevplatform/language/backgroundparser/parsejob.cpp:477
        file = @0x7f1c3c6de240: {d = 0x7f1c3c002780}
        _container_ =
          {c = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::ParsingEnvironmentFile> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7f1c3c6de230}, d = 0x7f1c3c6de230}}, i = {i = 0x7f1c3c6de240}, e = {i = 0x7f1c3c6de248}, control = 1}
        lock = {m_lock = 0x7f1c869921e0 <KDevelop::(anonymous namespace)::Q_QGS_sdDUChainPrivate::innerFunction()::holder+32>, m_locked = false, m_timeout = 0}
        __PRETTY_FUNCTION__ = "bool KDevelop::ParseJob::isUpdateRequired(const KDevelop::IndexedString&)"
#10 0x00007f1c56e565a8 in Php::ParseJob::run(QSharedPointer<ThreadWeaver::JobInterface>, ThreadWeaver::Thread*) (this=0x59293a0) at /home/flh/projects/kdev-php/phpparsejob.cpp:87
        urlLock = {m_url = {m_index = 337154}}
        p = {d = 0x0}
Comment 1 Kevin Funk 2016-12-22 09:45:50 UTC
As said on IRC, I'm puzzled how you can get into this state.

abstracttype.cpp:52:

if (decl && !decl->isFunctionDeclaration() && decl->abstractType()
    && decl->abstractType()->modifiers() & AbstractType::ConstModifier
    && !dynamic_cast<VariableDeclaration*>(decl) )

=> decl->abstractType() is checked whether it is null

CodeHighlightingInstance::highlightDUChain (in one of the parent frames) holds the DUChain lock so it can't be multi-threading related either. So how can the following snippet crash when decl->abstractType() is nullptr!?

decl->abstractType() && decl->abstractType()->modifiers()
Comment 2 Justin Zobel 2020-12-17 05:25:21 UTC
Thank you for the crash report.

As it has been a while since this was reported, can you please test and confirm if this issue is still occurring or if this bug report can be marked as resolved.

I have set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved/worksforme" when you respond, thank you.
Comment 3 Bug Janitor Service 2021-01-01 04:36:09 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2021-01-16 04:35:14 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!