| Summary: | Kate crash when pasting from clipboard | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Colin <colin> |
| Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | CC: | christoph, m00n.silv3r, slakware, walch.martin |
| Priority: | NOR | Keywords: | drkonqi |
| Version First Reported In: | 3.13.0 | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | somewhat minimalistic testcase | ||
|
Description
Colin
2014-06-13 23:11:37 UTC
(In reply to Colin from comment #0) > Set Highlighting to "none" for the CSS file because CSS highlighting is > broken in CSS files that use media queries. The broken media queries should be fixed in the 4.14 branch if the problem you encounter is the same as in bug #335744. Regarding this crash, I just reproduced it with Kate 3.13.3: #6 0x00007f73dd83644f in KSharedPtr (o=..., this=<synthetic pointer>) at /usr/include/ksharedptr.h:84 #7 KateScriptDocument::anchor (this=this@entry=0x2e628a0, line=1, column=<optimized out>, character=...) at /var/tmp/portage/kde-base/katepart-4.13.3/work/katepart-4.13.3/part/script/katescriptdocument.cpp:254 #8 0x00007f73dd7abd95 in KateScriptDocument::qt_static_metacall (_o=0x2e628a0, _id=<optimized out>, _a=0x7fff96c7a560, _c=<optimized out>) at /var/tmp/portage/kde-base/katepart-4.13.3/work/katepart-4.13.3_build/part/moc_katescriptdocument.cpp:381 #9 0x00007f73dd7acc5a in KateScriptDocument::qt_metacall (this=0x2e628a0, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x7fff96c7a560) at /var/tmp/portage/kde-base/katepart-4.13.3/work/katepart-4.13.3_build/part/moc_katescriptdocument.cpp:467 #10 0x00007f73dd1fb339 in QScript::callQtMethod (exec=exec@entry=0x7f7355f37248, callType=callType@entry=QMetaMethod::Method, thisQObject=thisQObject@entry=0x2e628a0, scriptArgs=..., meta=meta@entry=0x7f73ddbd0e80 <KateScriptDocument::staticMetaObject>, initialIndex=83, maybeOverloaded=true) at bridge/qscriptqobject.cpp:960 #11 0x00007f73dd1fcc07 in QScript::QtFunction::execute (this=this@entry=0x7f7355eceb40, exec=0x7f7355f37248, thisValue=..., thisValue@entry=..., scriptArgs=...) at bridge/qscriptqobject.cpp:1015 #12 0x00007f73dd1fce0d in QScript::QtFunction::call (exec=0x7f7355f37248, callee=0x7f7355eceb40, thisValue=..., args=...) at bridge/qscriptqobject.cpp:1030 #13 0x00007f73dd100350 in QTJSC::NativeFuncWrapper::operator() (this=this@entry=0x7fff96c7a790, exec=0x7f7355f37248, jsobj=jsobj@entry=0x7f7355eceb40, thisValue=..., argList=...) at ../3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.cpp:46 #14 0x00007f73dd0dd555 in QTJSC::cti_op_call_NotJSFunction (args=0x7fff96c7a7f0) at ../3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp:1780 #15 0x00007f735abccdac in ?? () #16 0x0000000000008000 in ?? () #17 0x00007f7355eceb40 in ?? () #18 0x00007f730000000e in ?? () #19 0xffff000000000004 in ?? () #20 0x00007f7355ec3ec0 in ?? () #21 0x0000000000000007 in ?? () #22 0x0000000000000040 in ?? () #23 0x0000000000000008 in ?? () #24 0x0000000000000200 in ?? () #25 0x00007f735aba18f0 in ?? () #26 0x00007f735a2cfc78 in ?? () #27 0x00007f7355f37248 in ?? () #28 0x00007f735a276688 in ?? () #29 0x00007f73dd488da8 in QTJSC::ExecutableAllocator::pageSize () from /usr/lib64/qt4/libQtScript.so.4 #30 0x00007f735a275400 in ?? () #31 0x00007f7355f37000 in ?? () #32 0x0000000002dcaa48 in ?? () #33 0x00007f73dd488da8 in QTJSC::ExecutableAllocator::pageSize () from /usr/lib64/qt4/libQtScript.so.4 #34 0x00007f7355f37060 in ?? () #35 0x00007f735a2cfc60 in ?? () #36 0x00007fff96c7a920 in ?? () #37 0x00007f73dd099770 in execute (exception=0x250dcc8, globalData=0x7f7355f37248, callFrame=0x7f7355f371d8, registerFile=0x20e, this=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/jit/JITCode.h:79 #38 QTJSC::Interpreter::execute (this=0x1f6, functionExecutable=0x7f735a2cfc78, callFrame=0xffff000000000002, function=0x7f735a276688, thisObj=<optimized out>, args=..., scopeChain=0x4000, exception=0x250dcc8) at ../3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp:716 Backtrace stopped: frame did not save the PC Created attachment 88257 [details]
somewhat minimalistic testcase
The crash does not happen always. I have good chances with
1. Open testcase in kate (CSS mode should be autoselected, i.e. CSS highlighting with C style indentation)
2. Deactivate highlighting, but keep C style indentation
3. Move cursor to the end of the second line
4. Press Enter
Now Kate should have crashed. If it has not crashed, close Kate and re-try. The crash happens for me in about one of two attempts.
The call to KateScriptDocument::anchor(...) happens in cstyle.js in the function
tryParenthesisBeforeBrace(line, column)
in the line
return document.anchor(line, column, '(');
After investigating the C++ code around the anchor method for several hours I hoped that the fix from bug #337785 might also fix this bug, but this is not the case.
The call to m_document->highlight()->attributes(QString&) gets as QString parameter "kate - Normal" and returns a list of varying size, most times 1 or 2 (I guess this is already suspicious?).
However the call document()->plainKateTextLine(cursor->line())->attribute(cursor->column()) returns 3 and is used as index into attributes. Sometimes this causes a segmentation fault and sometimes not. Chances to trigger the segmentation fault are better when running a fresh instance of Kate and not opening any other documents except the test case.
As I do not really understand what the code is doing there, it is hard for me to track this down. Maybe someone who knows the code better can look into this?
Perhaps commit Git commit c42cbd1e08288848422df09a9a4b98aaba53e21b by Christoph Cullmann. Committed on 17/08/2014 at 20:04. Pushed by cullmann into branch 'master'. fix unit test + try to fix segfault in anchor M +1 -1 autotests/src/katedocument_test.cpp M +3 -12 src/script/katescriptdocument.cpp http://commits.kde.org/ktexteditor/c42cbd1e08288848422df09a9a4b98aaba53e21b helps Martin, can you please check again so we can eventually close this report? :-) (In reply to Dominik Haumann from comment #5) > Martin, can you please check again so we can eventually close this report? > :-) Sorry, so far I cannot. I have not yet accomplished to successfully build KF5 on my computer and I will probably lack the time to investigate this further during the next few weeks. I think my patch did help, please reopen, if that still occurs. *** Bug 347428 has been marked as a duplicate of this bug. *** *** Bug 369655 has been marked as a duplicate of this bug. *** |