Bug 374525

Summary: KDevelop segfault when analyzing source code
Product: [Applications] kdevelop Reporter: Leslie Zhai <zhaixiang>
Component: Analyzer: CppcheckAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: kde, mail, simonandric5
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://git.reviewboard.kde.org/r/129767/
Latest Commit: Version Fixed In: 5.1.0
Sentry Crash Report:

Description Leslie Zhai 2017-01-04 06:38:37 UTC
Hi KDevelop developers,


Thread 1 "kdevelop" received signal SIGSEGV, Segmentation fault.
0x00007fffbbde43de in cppcheck::Parameters::Parameters (this=0x7fffffffa870, project=0x192f730)
    at /data/project/kde/kdevelop/analyzers/cppcheck/parameters.cpp:110
110         m_projectBuildPath   = m_project->buildSystemManager()->buildDirectory(m_project->projectItem());


so I simply added if (m_project->buildSystemManager()) check before m_project->buildSystemManager()->buildDirectory(...)

Regards,
Leslie Zhai
Comment 1 Leslie Zhai 2017-01-04 06:49:43 UTC
kdev-clang-tidy also segfault when analyzing source code.
Comment 2 Kevin Funk 2017-01-04 07:52:34 UTC
Full backtrace next time please. And please upload diffs to Phabricator so we can review them easily.
Comment 3 Leslie Zhai 2017-01-04 08:28:22 UTC
Hi Kevin,

Thanks for your reply!

> Full backtrace next time please.
OK!

Please review my patch https://git.reviewboard.kde.org/r/129767/

Regards,
Leslie Zhai
Comment 4 Leslie Zhai 2017-01-04 09:12:22 UTC
Hi Kevin,

Please review my patch in Phabricator https://phabricator.kde.org/D3949 about filtering -Wdocumentation parser errors.

Thanks a lot!

Regards,
Leslie Zhai
Comment 5 Francis Herne 2017-01-04 12:11:00 UTC
This happens when the Generic Project Manager is used (because it doesn't have a build system).

It also crashes - at the same line - when opening "Configure Project" for a generic project when the CPPCheck plugin is loaded, even if it's not used or applicable.
Comment 6 Kevin Funk 2017-01-04 12:50:19 UTC
Git commit fe1a940bf1278eee8a8b3248222195f2cb5a8bde by Kevin Funk, on behalf of Leslie Zhai.
Committed on 04/01/2017 at 12:49.
Pushed by kfunk into branch '5.1'.

Fix segfault when analyzing source code issue

Hi KDevelop developers,

```
Thread 1 "kdevelop" received signal SIGSEGV, Segmentation fault.
0x00007fffbbde43de in cppcheck::Parameters::Parameters (this=0x7fffffffa870, project=0x192f730)
    at /data/project/kde/kdevelop/analyzers/cppcheck/parameters.cpp:110
110         m_projectBuildPath   = m_project->buildSystemManager()->buildDirectory(m_project->projectItem());
```

so I simply added ```if (m_project->buildSystemManager())``` check before calling ```m_project->buildSystemManager()->buildDirectory(...)```

Regards,
Leslie Zhai

REVIEW: 129767
FIXED-IN: 5.1.0

M  +9    -3    analyzers/cppcheck/parameters.cpp

https://commits.kde.org/kdevelop/fe1a940bf1278eee8a8b3248222195f2cb5a8bde
Comment 7 Kevin Funk 2017-01-16 09:57:01 UTC
Git commit 0c518250b10068f11601be44ed06f45d8f8e3660 by Kevin Funk.
Committed on 16/01/2017 at 09:56.
Pushed by kfunk into branch 'master'.

Fix segfault when analyzing source code

Fix clang-tidy run when there's no build system manager

REVIEW: 129768

M  +3    -2    src/plugin.cpp

https://commits.kde.org/kdev-clang-tidy/0c518250b10068f11601be44ed06f45d8f8e3660
Comment 8 Francis Herne 2017-03-30 09:12:59 UTC
*** Bug 376955 has been marked as a duplicate of this bug. ***