Skip to content

Fix renamed file is not openable directly

Waqar Ahmed requested to merge work/renaminng into master

This is not really a fix yet, it makes things work but it not completely right. The right fix, imo, would be to update the file2Item as well in KateProject, this is done, but I will push it once the following problem is resolved:

As mentioned in the group this change leads to a crash with the following steps:

  1. Open any file, for e.g README.md
  2. Rename it, while it is opened. You will get a message to close the file upon focusing the view
  3. Close the view
  4. Try to open the renamed file by clicking the file in projectTreeView = Crash

Here's a backtrace:

#3  0x00007faa7f739c50 in operator<< <KTextEditor::View*> (list=..., debug=...) at /usr/include/qt/QtCore/qdebug.h:240
#4  KTextEditor::DocumentPrivate::views (this=0x56079f83bd20)
    at /home/waqar/kde/build/frameworks/ktexteditor/src/KF5TextEditor_autogen/DV7UALDUNI/../../../../../../src/frameworks/ktexteditor/src/document/katedocument.h:136
#5  0x00007faa7f73bc6d in Kate::TextBuffer::notifyAboutRangeChange (this=<optimized out>, view=0x56079f142f90, lineRange=..., rangeWithAttribute=true)
    at /home/waqar/kde/src/frameworks/ktexteditor/src/buffer/katetextbuffer.cpp:935
#6  0x00007faa7f839342 in KateViewInternal::updateBracketMarkAttributes (this=0x56079ee6ed10)
    at /home/waqar/kde/src/frameworks/ktexteditor/src/view/kateviewinternal.cpp:2288
#7  0x00007faa7f8269f8 in KTextEditor::ViewPrivate::updateRendererConfig (this=0x56079f142f90)
    at /home/waqar/kde/src/frameworks/ktexteditor/src/view/kateview.cpp:2062
#8  0x00007faa7f79bc29 in KTextEditor::DocumentPrivate::updateFileType (this=this@entry=0x56079f83bd20, newType=..., user=user@entry=false)
    at /home/waqar/kde/src/frameworks/ktexteditor/src/render/katerenderer.h:467
#9  0x00007faa7f7ace0f in KTextEditor::DocumentPrivate::openFile (this=0x56079f83bd20)
    at /home/waqar/kde/src/frameworks/ktexteditor/src/document/katedocument.cpp:2339
#10 0x00007faa7f631625 in KParts::ReadOnlyPartPrivate::openLocalFile (this=this@entry=0x56079f796430)
    at /home/waqar/kde/src/frameworks/kparts/src/readonlypart.cpp:180
#11 0x00007faa7f6323b3 in KParts::ReadOnlyPart::openUrl (this=this@entry=0x56079f83bd20, url=...) at /home/waqar/kde/src/frameworks/kparts/src/readonlypart.cpp:141
#12 0x00007faa7f799d42 in KTextEditor::DocumentPrivate::openUrl (this=0x56079f83bd20, url=...)
    at /home/waqar/kde/src/frameworks/ktexteditor/src/document/katedocument.cpp:2761
#13 0x000056079d08f356 in KateDocManager::openUrl (this=0x7ffe1132ae08, url=..., encoding=..., isTempFile=isTempFile@entry=false, docInfo=...)
    at /home/waqar/kde/src/kde/applications/kate/kate/katedocmanager.cpp:178
#14 0x000056079d0b4805 in KateViewManager::openUrlWithView (this=0x56079f03de90, url=..., encoding=...)
    at /home/waqar/kde/src/kde/applications/kate/kate/kateviewmanager.cpp:307
#15 0x000056079d0c9647 in KateMainWindow::openUrl (encoding=..., url=..., this=0x56079eecf190)
    at /home/waqar/kde/src/kde/applications/kate/Release/kate/kate-lib_autogen/EWIEGA46WW/../../../../kate/katemainwindow.h:367
#16 KateMainWindow::qt_static_metacall (_o=0x56079eecf190, _c=<optimized out>, _id=<optimized out>, _a=0x7ffe11329760)
    at /home/waqar/kde/src/kde/applications/kate/Release/kate/kate-lib_autogen/EWIEGA46WW/moc_katemainwindow.cpp:440
#17 0x00007faa7d84f53b in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () from /usr/lib/libQt5Core.so.5
#18 0x00007faa7d850ef4 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /usr/lib/libQt5Core.so.5
#19 0x00007faa7f8a1cb0 in KTextEditor::MainWindow::openUrl (this=this@entry=0x56079f189ed0, url=..., encoding=...)
    at /home/waqar/kde/src/frameworks/ktexteditor/src/utils/mainwindow.cpp:72
#20 0x00007faa72992732 in KateProjectViewTree::slotClicked (this=0x56079f3e0b70, index=...)
    at /home/waqar/kde/src/kde/applications/kate/addons/project/kateprojectviewtree.cpp:179

Merge request reports

Loading