KatePart causes Konqueror to crash when using the :q! Vi command

christoph at cullmann.io christoph at cullmann.io
Sun Mar 24 16:18:13 GMT 2024


On 2024-03-24 12:04, Stefano Crocco wrote:
> Hello to everyone,
> I hope this is the correct place to ask for information about a crash
> regarding Kate part. If not, sorry for the noise.
> 
> A user reported a bug [1] for Konqueror, stating that when opening a 
> text
> document in Konqueror using Kate part and using the Vi command :q! 
> Konqueror
> crashes. According to the attached backtrace, the crash comes from 
> within
> KTextEditor, but I'm not sure it's a bug within the framework itself or 
> it's
> Konqueror which is using it in the wrong way.
> 
> According to the attached backtrace (from KTextEditor 6.0.0), the crash
> happens in AppCommands::closeCurrentDocument() (line 302 of 
> appcommands.cpp).
> The problem seems to be that AppCommands::closeCurrentDocument() calls
> activeView()->document() but activeView() is nullptr. According to the
> documentation for KTextEditor::MainWindow::activeView( ), this is 
> expected if
> the active view is not available. I think there are the following
> possibilities:
> - closeCurrentDocument correctly assumes that in this situation 
> activeView()
> should not return nullptr. The fact that it returns nullptr is caused 
> by
> Konqueror not using KTextEditor correctly
> - as above, but it's KTextEditor which fails to correctly set the 
> active view
> - closeCurrentDocument is wrong in assuming that activeView() is valid 
> and
> should check whether this is true before using it.
> 
> Without any knowledge of the internals of KTextEditor, I'd say that it 
> makes
> sense for activeView() not to be nullptr, since the user just typed a 
> command
> from within it, so I think the first two possibilities are the most 
> likely.
> Konqueror itself doesn't do anything special with the part: it creates 
> it
> using KPluginFactory::create and puts it inside a tab view, just as it 
> does
> with any other part.
> 
> Could anyone tell me if it's Konqueror doing something wrong (and maybe 
> give
> me a hint about what it's doing wrong) or it's a problem within 
> KatePart
> itself?

Hi,

thanks for pointing do that, fixed with

https://invent.kde.org/frameworks/ktexteditor/-/commit/e9ea498d0e9f938510ae35612266097587a03746

Greetings
Christoph

> 
> Thanks in advance
> 
> Stefano
> 
> [1] https://bugs.kde.org/show_bug.cgi?id=482436


More information about the Kde-frameworks-devel mailing list