Bug 342037 - Crash in Sublime::View when creating a non-C++ file in a project
Summary: Crash in Sublime::View when creating a non-C++ file in a project
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: sublime (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-19 18:42 UTC by Nicolai Hähnle
Modified: 2014-12-22 10:16 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 Nicolai Hähnle 2014-12-19 18:42:08 UTC
Creating a .py file in a custom C++ Makefile project, without the kdev-python plugin being loaded, I got the following crash. I got similar crashes when trying to edit the file later, though I haven't found a reliable pattern for reproduction.

Reproducible: Couldn't Reproduce




Final lines of output and a backtrace of the crash. Note: In frame #0, this is a nullptr.

kdevplatform.sublime: view added in Sublime::Area(0xd2fca0, name = "debug")
kdevplatform.shell: added view in Sublime::Area(0xd2fca0, name = "debug") , id "code_6708761"
kdevplatform.shell: doing nothing because loading
kdevplatform.shell: deleting  0  old views
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
katepart: **********************_noIndentationBasedFolding is TRUE*****************
kdevplatform.language: Creating change tracker for   QUrl( "file:///home/haehnle/gitdata/bonnvoxel/test_generate.py" )
*** Program received signal SIGSEGV (Segmentation fault) ***


#0 Sublime::View::document() at /home/haehnle/software/kdevelop/kdevplatform/sublime/view.cpp:69
#1 Sublime::sortViews() at /home/haehnle/software/kdevelop/kdevplatform/sublime/container.cpp:89
#2 __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(Sublime::View const*, Sublime::View const*)>::operator()<Sublime::View**, Sublime::View**>() at /usr/include/c++/4.9/bits/predefined_ops.h:121
#3 std::__insertion_sort<Sublime::View**, __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(Sublime::View const*, Sublime::View const*)> >() at /usr/include/c++/4.9/bits/stl_algo.h:1846
#4 std::__final_insertion_sort<Sublime::View**, __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(Sublime::View const*, Sublime::View const*)> >() at /usr/include/c++/4.9/bits/stl_algo.h:1889
#5 std::__sort<Sublime::View**, __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(Sublime::View const*, Sublime::View const*)> >() at /usr/include/c++/4.9/bits/stl_algo.h:1970
#6 std::sort<Sublime::View**, bool (*)(Sublime::View const*, Sublime::View const*)>() at /usr/include/c++/4.9/bits/stl_algo.h:4716
#7 Sublime::ContainerPrivate::updateDocumentListPopupMenu() at /home/haehnle/software/kdevelop/kdevplatform/sublime/container.cpp:127
#8 Sublime::Container::addWidget() at /home/haehnle/software/kdevelop/kdevplatform/sublime/container.cpp:307
#9 Sublime::MainWindowPrivate::ViewCreator::operator()() at /home/haehnle/software/kdevelop/kdevplatform/sublime/mainwindow_p.cpp:335
#10 Sublime::Area::walkViewsInternal<Sublime::MainWindowPrivate::ViewCreator>() at /home/haehnle/software/kdevelop/kdevplatform/sublime/areawalkers.h:32
#11 Sublime::Area::walkViews<Sublime::MainWindowPrivate::ViewCreator>() at /home/haehnle/software/kdevelop/kdevplatform/sublime/areawalkers.h:48
#12 Sublime::MainWindowPrivate::viewAdded() at /home/haehnle/software/kdevelop/kdevplatform/sublime/mainwindow_p.cpp:506
#13 QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<Sublime::AreaIndex*, Sublime::View*>, void, void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*)>::call() at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:508
#14 QtPrivate::FunctionPointer<void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*)>::call<QtPrivate::List<Sublime::AreaIndex*, Sublime::View*>, void>() at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:527
#15 QtPrivate::QSlotObject<void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*), QtPrivate::List<Sublime::AreaIndex*, Sublime::View*>, void>::impl() at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject_impl.h:151
#16 call() at /build/buildd/qtbase-opensource-src-5.3.0+dfsg/src/corelib/kernel/qobject_impl.h:132
#17 QMetaObject::activate() at /build/buildd/qtbase-opensource-src-5.3.0+dfsg/src/corelib/kernel/qobject.cpp:3666
#18 Sublime::Area::viewAdded() at /home/haehnle/software/kdevelop/kdevplatform/build/sublime/moc_area.cpp:247
#19 Sublime::Area::addView() at /home/haehnle/software/kdevelop/kdevplatform/sublime/area.cpp:176
#20 Sublime::Area::addView() at /home/haehnle/software/kdevelop/kdevplatform/sublime/area.cpp:188
#21 KDevelop::DocumentControllerPrivate::openDocumentInternal() at /home/haehnle/software/kdevelop/kdevplatform/shell/documentcontroller.cpp:480
#22 KDevelop::DocumentControllerPrivate::openDocumentInternal() at /home/haehnle/software/kdevelop/kdevplatform/shell/documentcontroller.cpp:326
#23 KDevelop::DocumentController::openDocument() at /home/haehnle/software/kdevelop/kdevplatform/shell/documentcontroller.cpp:710
#24 createFile() at /home/haehnle/software/kdevelop/kdevplatform/plugins/projectmanagerview/projectmanagerviewplugin.cpp:634
#25 ProjectManagerViewPlugin::createFileFromContextMenu() at /home/haehnle/software/kdevelop/kdevplatform/plugins/projectmanagerview/projectmanagerviewplugin.cpp:644
Comment 1 Nicolai Hähnle 2014-12-19 23:08:35 UTC
Git commit fa8ab02ebd8f88c7214538cdf4b7e8c1ac07cd98 by Nicolai Hähnle.
Committed on 19/12/2014 at 12:28.
Pushed by nicolaih into branch 'master'.

sublime: prevent accidentally adding nullptrs to ContainerPrivate::viewForWidget

The likely culprit here is using operator[] to access a map, which implicitly
creates an entry containing a null view. I have audited all other accesses of
viewForWidget with operator[] to verify that they happen in a context where
the entry is non-null (either because the access is used to assign a non-null
view pointer or because the access is guaranteed to crash or abort immediately
if it would create an incorrect nullptr entry).
REVIEW: 121600

M  +2    -2    sublime/container.cpp

http://commits.kde.org/kdevplatform/fa8ab02ebd8f88c7214538cdf4b7e8c1ac07cd98
Comment 2 Kevin Funk 2014-12-22 10:16:52 UTC
Git commit c394eb8dd2fcd090e661695bd318c35af6578024 by Kevin Funk, on behalf of Nicolai Hähnle.
Committed on 19/12/2014 at 12:28.
Pushed by kfunk into branch '1.7'.

sublime: prevent accidentally adding nullptrs to ContainerPrivate::viewForWidget

The likely culprit here is using operator[] to access a map, which implicitly
creates an entry containing a null view. I have audited all other accesses of
viewForWidget with operator[] to verify that they happen in a context where
the entry is non-null (either because the access is used to assign a non-null
view pointer or because the access is guaranteed to crash or abort immediately
if it would create an incorrect nullptr entry).
REVIEW: 121600
(cherry picked from commit fa8ab02ebd8f88c7214538cdf4b7e8c1ac07cd98)

M  +2    -2    sublime/container.cpp

http://commits.kde.org/kdevplatform/c394eb8dd2fcd090e661695bd318c35af6578024