Bug 468595 - creating second new file crashes [KDevelop::IDocumentController::textDocumentCreated]
Summary: creating second new file crashes [KDevelop::IDocumentController::textDocument...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: git master
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-17 05:16 UTC by Rolf Eike Beer
Modified: 2023-09-15 11:42 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.13.231200
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Eike Beer 2023-04-17 05:16:05 UTC
git master at commit 5283f6ab4e3d4b6e21327eadf74b5ec9276e5dee

STEPS TO REPRODUCE
1. create a new file (Ctrl-N)
2. save it (no content needed)
3. create another new file

OBSERVED RESULT

ASSERT: "!m_visualizers.contains(documentUrl)" in file /home/ebeer/repos/upstream/KDE/kdevelop/plugins/problemreporter/problemreporterplugin.cpp, line 145

#0  0x00007ffff2694d7c in __pthread_kill_implementation () at /lib64/libc.so.6
#1  0x00007ffff2643356 in raise () at /lib64/libc.so.6
#2  0x00007ffff262b897 in abort () at /lib64/libc.so.6
#3  0x00007ffff2cbb4e9 in  () at /lib64/libQt5Core.so.5
#4  0x00007ffff2cba720 in qt_assert_x(char const*, char const*, char const*, int) () at /lib64/libQt5Core.so.5
#5  0x00007fffbc0fb948 in ProblemReporterPlugin::textDocumentCreated(KDevelop::IDocument*) (this=0xced010, document=0x30cda80) at /home/ebeer/repos/upstream/KDE/kdevelop/plugins/problemreporter/problemreporterplugin.cpp:145
#6  0x00007fffbc101955 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<KDevelop::IDocument*>, void, void (ProblemReporterPlugin::*)(KDevelop::IDocument*)>::call(void (ProblemReporterPlugin::*)(KDevelop::IDocument*), ProblemReporterPlugin*, void**)
     (f=(void (ProblemReporterPlugin::*)(ProblemReporterPlugin * const, KDevelop::IDocument *)) 0x7fffbc0fb882 <ProblemReporterPlugin::textDocumentCreated(KDevelop::IDocument*)>, o=0xced010, arg=0x7fffffffa3b0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
#7  0x00007fffbc101304 in QtPrivate::FunctionPointer<void (ProblemReporterPlugin::*)(KDevelop::IDocument*)>::call<QtPrivate::List<KDevelop::IDocument*>, void>(void (ProblemReporterPlugin::*)(KDevelop::IDocument*), ProblemReporterPlugin*, void**)
     (f=(void (ProblemReporterPlugin::*)(ProblemReporterPlugin * const, KDevelop::IDocument *)) 0x7fffbc0fb882 <ProblemReporterPlugin::textDocumentCreated(KDevelop::IDocument*)>, o=0xced010, arg=0x7fffffffa3b0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
#8  0x00007fffbc0fff83 in QtPrivate::QSlotObject<void (ProblemReporterPlugin::*)(KDevelop::IDocument*), QtPrivate::List<KDevelop::IDocument*>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0xd0bf90, r=0xced010, a=0x7fffffffa3b0, ret=0x0)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418
#9  0x00007ffff2f25402 in  () at /lib64/libQt5Core.so.5
#10 0x00007ffff5eecc3b in KDevelop::IDocumentController::textDocumentCreated(KDevelop::IDocument*) (this=0xda0460, _t1=0x30cda80) at /home/ebeer/repos/build/KDE/kdevelop/kdevplatform/interfaces/KDevPlatformInterfaces_autogen/EWIEGA46WW/moc_idocumentcontroller.cpp:451
#11 0x00007ffff5ef65d8 in KDevelop::IDocument::notifyTextDocumentCreated() (this=0x30cda80) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/interfaces/idocument.cpp:95
#12 0x00007ffff7ce68ae in KDevelop::TextDocument::createViewWidget(QWidget*) (this=0x30cda60, parent=0x21d5c10) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/shell/textdocument.cpp:364
#13 0x00007ffff7ce7d89 in KDevelop::TextView::createWidget(QWidget*) (this=0x323fbe0, parent=0x21d5c10) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/shell/textdocument.cpp:623
#14 0x00007ffff7f2c2de in Sublime::View::widget(QWidget*) (this=0x323fbe0, parent=0x21d5c10) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/sublime/view.cpp:72
#15 0x00007ffff7f21587 in Sublime::MainWindowPrivate::ViewCreator::operator()(Sublime::AreaIndex*) (this=0x7fffffffa970, index=0xa9b000) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/sublime/mainwindow_p.cpp:403
#16 0x00007ffff7f26f4f in Sublime::Area::walkViewsInternal<Sublime::MainWindowPrivate::ViewCreator>(Sublime::MainWindowPrivate::ViewCreator&, Sublime::AreaIndex*) (this=0xa9af80, op=..., index=0xa9b000) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/sublime/areawalkers.h:20
#17 0x00007ffff7f25263 in Sublime::Area::walkViews<Sublime::MainWindowPrivate::ViewCreator>(Sublime::MainWindowPrivate::ViewCreator&, Sublime::AreaIndex*) (this=0xa9af80, op=..., index=0xa9b000) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/sublime/areawalkers.h:36
#18 0x00007ffff7f221e5 in Sublime::MainWindowPrivate::viewAdded(Sublime::AreaIndex*, Sublime::View*) (this=0x85c020, index=0xa9b000, view=0x323fbe0) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/sublime/mainwindow_p.cpp:573
#19 0x00007ffff7f1e3d2 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<Sublime::AreaIndex*, Sublime::View*>, void, void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*)>::call(void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*), Sublime::MainWindowPrivate*, void**) (f=(void (Sublime::MainWindowPrivate::*)(Sublime::MainWindowPrivate * const, Sublime::AreaIndex *, Sublime::View *)) 0x7ffff7f22004 <Sublime::MainWindowPrivate::viewAdded(Sublime::AreaIndex*, Sublime::View*)>, o=0x85c020, arg=0x7fffffffab70)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
#20 0x00007ffff7f1ded2 in QtPrivate::FunctionPointer<void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*)>::call<QtPrivate::List<Sublime::AreaIndex*, Sublime::View*>, void>(void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*), Sublime::MainWindowPrivate*, void**)
    (f=(void (Sublime::MainWindowPrivate::*)(Sublime::MainWindowPrivate * const, Sublime::AreaIndex *, Sublime::View *)) 0x7ffff7f22004 <Sublime::MainWindowPrivate::viewAdded(Sublime::AreaIndex*, Sublime::View*)>, o=0x85c020, arg=0x7fffffffab70) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
#21 0x00007ffff7f1d995 in QtPrivate::QSlotObject<void (Sublime::MainWindowPrivate::*)(Sublime::AreaIndex*, Sublime::View*), QtPrivate::List<Sublime::AreaIndex*, Sublime::View*>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x22300d0, r=0x85c020, a=0x7fffffffab70, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418
#22 0x00007ffff2f25402 in  () at /lib64/libQt5Core.so.5
#23 0x00007ffff7ef752a in Sublime::Area::viewAdded(Sublime::AreaIndex*, Sublime::View*) (this=0xa9af80, _t1=0xa9b000, _t2=0x323fbe0) at /home/ebeer/repos/build/KDE/kdevelop/kdevplatform/sublime/KDevPlatformSublime_autogen/EWIEGA46WW/moc_area.cpp:285
#24 0x00007ffff7efbea7 in Sublime::Area::addView(Sublime::View*, Sublime::AreaIndex*, Sublime::View*) (this=0xa9af80, view=0x323fbe0, index=0xa9b000, after=0x7fffd4002d10) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/sublime/area.cpp:177
#25 0x00007ffff7efbf2c in Sublime::Area::addView(Sublime::View*, Sublime::View*) (this=0xa9af80, view=0x323fbe0, after=0x7fffd4002d10) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/sublime/area.cpp:191
#26 0x00007ffff7cf74ac in KDevelop::DocumentControllerPrivate::openDocumentInternal(KDevelop::IDocument*, KTextEditor::Range const&, QFlags<KDevelop::IDocumentController::DocumentActivation>, KDevelop::IDocument*)
    (this=0xcad6a0, doc=0x30cda80, range=[(-1, -1) -> (-1, -1)], activationParams=..., buddy=0x0) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/shell/documentcontroller.cpp:481
#27 0x00007ffff7cf6803 in KDevelop::DocumentControllerPrivate::openDocumentInternal(QUrl const&, QString const&, KTextEditor::Range const&, QString const&, QFlags<KDevelop::IDocumentController::DocumentActivation>, KDevelop::IDocument*)
     (this=0xcad6a0, inputUrl=file:///Untitled, prefName="", range=[(-1, -1) -> (-1, -1)], encoding="", activationParams=..., buddy=0x0) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/shell/documentcontroller.cpp:331
#28 0x00007ffff7ceef89 in KDevelop::DocumentController::openDocument(QUrl const&, KTextEditor::Range const&, QFlags<KDevelop::IDocumentController::DocumentActivation>, QString const&, KDevelop::IDocument*)
    (this=0xda0460, inputUrl=file:///Untitled, range=[(-1, -1) -> (-1, -1)], activationParams=..., encoding="", buddy=0x0) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/shell/documentcontroller.cpp:713
#29 0x00007ffff7c9c071 in KDevelop::MainWindowPrivate::fileNew() (this=0x9156f0) at /home/ebeer/repos/upstream/KDE/kdevelop/kdevplatform/shell/mainwindow_actions.cpp:175
#30 0x00007ffff7c9f9a6 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KDevelop::MainWindowPrivate::*)()>::call(void (KDevelop::MainWindowPrivate::*)(), KDevelop::MainWindowPrivate*, void**)
    (f=(void (KDevelop::MainWindowPrivate::*)(KDevelop::MainWindowPrivate * const)) 0x7ffff7c9bff4 <KDevelop::MainWindowPrivate::fileNew()>, o=0x9156f0, arg=0x7fffffffb4d0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
#31 0x00007ffff7c9f4b6 in QtPrivate::FunctionPointer<void (KDevelop::MainWindowPrivate::*)()>::call<QtPrivate::List<>, void>(void (KDevelop::MainWindowPrivate::*)(), KDevelop::MainWindowPrivate*, void**)
    (f=(void (KDevelop::MainWindowPrivate::*)(KDevelop::MainWindowPrivate * const)) 0x7ffff7c9bff4 <KDevelop::MainWindowPrivate::fileNew()>, o=0x9156f0, arg=0x7fffffffb4d0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
#32 0x00007ffff7c9e991 in QtPrivate::QSlotObject<void (KDevelop::MainWindowPrivate::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x8d0ce0, r=0x9156f0, a=0x7fffffffb4d0, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418
#33 0x00007ffff2f25402 in  () at /lib64/libQt5Core.so.5
#34 0x00007ffff3d9e9e2 in QAction::triggered(bool) () at /lib64/libQt5Widgets.so.5
#35 0x00007ffff3da155f in QAction::activate(QAction::ActionEvent) () at /lib64/libQt5Widgets.so.5
#36 0x00007ffff3da213d in QAction::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#37 0x00007ffff3da52ce in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#38 0x00007ffff2eecb28 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#39 0x00007ffff35ac191 in QShortcutMap::dispatchEvent(QKeyEvent*) () at /lib64/libQt5Gui.so.5
#40 0x00007ffff35acdab in QShortcutMap::tryShortcut(QKeyEvent*) () at /lib64/libQt5Gui.so.5
#41 0x00007ffff3553716 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () at /lib64/libQt5Gui.so.5
#42 0x00007ffff35786ad in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () at /lib64/libQt5Gui.so.5
#43 0x00007ffff355010c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Gui.so.5
#44 0x00007fffe470d16a in  () at /lib64/libQt5XcbQpa.so.5
#45 0x00007ffff0f16f96 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#46 0x00007ffff0f17358 in  () at /lib64/libglib-2.0.so.0
#47 0x00007ffff0f173ec in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#48 0x00007ffff2f460b6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#49 0x00007ffff2eeb5cb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#50 0x00007ffff2ef3a50 in QCoreApplication::exec() () at /lib64/libQt5Core.so.5
#51 0x0000000000413e2a in main(int, char**) (argc=1, argv=0x7fffffffd748) at /home/ebeer/repos/upstream/KDE/kdevelop/app/main.cpp:841


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed, currently at KDE Gear 22.12.3
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.8+kde8
Comment 1 Igor Kushnir 2023-04-17 09:12:49 UTC
Cannot reproduce in an existing session or in a new session. Some configuration, filename, etc. is probably necessary to reproduce the bug.
Comment 2 Rolf Eike Beer 2023-04-17 11:34:57 UTC
I can easily reproduce this. Please tell me what information I should look for.
Comment 3 Igor Kushnir 2023-04-17 13:01:37 UTC
Try in a new KDevelop session. Save under different filenames, extensions, on different disks. Try as a different user as some configuration can be the culprit.

Is this a very recent regression? In KDevelop or its dependency?
Comment 4 Igor Kushnir 2023-04-17 16:18:22 UTC
Just reproduced the assertion failure. There is probably no crash with assertions disabled. I'll try to fix it.
Comment 5 Bug Janitor Service 2023-04-19 13:57:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/457
Comment 6 Igor Kushnir 2023-09-15 11:42:07 UTC
Git commit b3f651be72550196659ce46b5414efb0484f8e4c by Igor Kushnir.
Committed on 15/09/2023 at 13:41.
Pushed by igorkushnir into branch 'master'.

problemreporter: handle text document URL changes

A text document's URL can be changed when:
1) a new Untitled document is saved;
2) an open document is saved under a different name (File=>Save As...).

ProblemReporterPlugin does not listen to
IDocumentController::documentUrlChanged signal, and therefore keeps
referencing text documents by stale URLs. So when a document is renamed,
then another document is created or opened at its previous URL, the
assertion Q_ASSERT(!m_visualizers.contains(documentUrl)) in
ProblemReporterPlugin::textDocumentCreated() fails. Another consequence
is that inline problem notes never appear in the renamed document.

Replace the URL key of the renamed document's visualizer and remove the
obsolete URL from m_reHighlightNeeded set.

When the default problem scope "Current Document" is selected, an active
document is not highlighted right after it is renamed. The user has to
activate another document, then go back to the renamed one for the
highlighting to appear. This is a consequence of another missing
connection to the documentUrlChanged signal in ProblemModel. Will be
addressed in a subsequent commit.
FIXED-IN: 5.13.231200

M  +5    -0    plugins/problemreporter/problemhighlighter.h
M  +36   -0    plugins/problemreporter/problemreporterplugin.cpp
M  +1    -0    plugins/problemreporter/problemreporterplugin.h

https://invent.kde.org/kdevelop/kdevelop/-/commit/b3f651be72550196659ce46b5414efb0484f8e4c