Bug 282995

Summary: Crash on short file php/js/html
Product: [Applications] kate Reporter: Tomasz Narloch <tomas.h>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tomasz Narloch 2011-09-28 21:54:21 UTC
Application: kate (3.6.5)
KDE Platform Version: 4.6.5 (4.6.5)
Qt Version: 4.7.2
Operating System: Linux 2.6.38-11-generic x86_64
Distribution: Ubuntu 11.04

-- Information about the crash:
=== FILE CODE BELOW: ===
<?php
defined('_JEXEC') or die;

/**
 * Floating Box
 * @description:
 */

JHTML::_('behavior.mootools');

$type = (int) $params->get('type', 0);
$style1 = $params->get('style1', '');
$style2 = $params->get('style2', '');
$html = $params->get('html', '');
$relativeedge = (int) $params->get('relativeedge', 0); // 0 - top
$id = 'floating_box_'.$module->id;

echo '<div id="'.$id.'">'.$html.'</div>';
?>

<script type="text/javascript">
window.addEvent('scroll', function() {
	var elem = $(<?php ec),
		windowH = window.getSize().y,
		offsetY = window.getScroll().y,
		documentH = window.getScrollSize().y;

	elem.setStyle('height', elem.getSize().y);
	var parentH = elem.getParent().getSize().y,
		parentY = elem.getParent().getOffsets().y,
		floatElem = elem.getFirst();

	if (offsetY + windowH >= parentY + parentH - elem.getStyle('marginBottom').toInt()) {
		floatElem.setStyles({'position': '', 'bottom': '', 'width': ''});
	} else {
		if (!floatElem.style.width) {
			floatElem.setStyle('width', floatElem.getSize().x+'px')
		}
		floatElem.setStyles({'position': 'fixed','bottom': 0});
		}
	});
});
</script>
=== END CODE ===

On line 23: 	var elem = $(<?php ec),
I try to write after "<?php ec":
ho?>

AND CRASH
I have custom compiled kate from svn (1-2 weeks old).
I run it by kde/run.sh kate.

The crash can be reproduced every time.

-- Backtrace:
Application: Kate (kate), signal: Segmentation fault
[Current thread is 1 (Thread 0x7fe95627e780 (LWP 24225))]

Thread 4 (Thread 0x7fe942650700 (LWP 24231)):
#0  0x00007fe951bfff03 in __poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=<value optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fe94e6f3104 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fe94e6f3639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fe9527e2446 in QEventDispatcherGlib::processEvents (this=0x15d8b80, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:424
#4  0x00007fe9527b6882 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fe9527b6abc in QEventLoop::exec (this=0x7fe94264fdd0, flags=...) at kernel/qeventloop.cpp:201
#6  0x00007fe9526cd924 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:492
#7  0x00007fe952798c2f in QInotifyFileSystemWatcherEngine::run (this=0x15d6f90) at io/qfilesystemwatcher_inotify.cpp:248
#8  0x00007fe9526d0175 in QThreadPrivate::start (arg=0x15d6f90) at thread/qthread_unix.cpp:320
#9  0x00007fe94fd9fd8c in start_thread (arg=0x7fe942650700) at pthread_create.c:304
#10 0x00007fe951c0d04d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fe941d12700 (LWP 24247)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fe9441af2a2 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x7fe9444c8180) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#2  0x00007fe9441af2d9 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=0x7fe9444d6254) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#3  0x00007fe94fd9fd8c in start_thread (arg=0x7fe941d12700) at pthread_create.c:304
#4  0x00007fe951c0d04d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fe93ac77700 (LWP 24256)):
#0  0x00007fe951bfff03 in __poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=<value optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fe94e6f3104 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fe94e6f3639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fe9527e2446 in QEventDispatcherGlib::processEvents (this=0x189c5a0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:424
#4  0x00007fe9527b6882 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fe9527b6abc in QEventLoop::exec (this=0x7fe93ac76dd0, flags=...) at kernel/qeventloop.cpp:201
#6  0x00007fe9526cd924 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:492
#7  0x00007fe952798c2f in QInotifyFileSystemWatcherEngine::run (this=0x18a2f00) at io/qfilesystemwatcher_inotify.cpp:248
#8  0x00007fe9526d0175 in QThreadPrivate::start (arg=0x18a2f00) at thread/qthread_unix.cpp:320
#9  0x00007fe94fd9fd8c in start_thread (arg=0x7fe93ac77700) at pthread_create.c:304
#10 0x00007fe951c0d04d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fe95627e780 (LWP 24225)):
[KCrash Handler]
#6  0x00007fe943c9c5a1 in QVector<KateCodeFoldingNode*>::size (this=0x1cf75a8) at /usr/include/qt4/QtCore/qvector.h:124
#7  0x00007fe943c95f62 in KateCodeFoldingNode::removeEndDescending (this=0x1cf7570, deletedNode=0x1c85df0) at /home/tomek2/kde/kate/part/syntax/katecodefolding.cpp:256
#8  0x00007fe943c960af in KateCodeFoldingNode::removeChild (this=0x1cf7570, deletedNode=0x1c85df0) at /home/tomek2/kde/kate/part/syntax/katecodefolding.cpp:303
#9  0x00007fe943c9733c in KateCodeFoldingTree::deleteEndNode (this=0x131d340, deletedNode=0x1c85df0) at /home/tomek2/kde/kate/part/syntax/katecodefolding.cpp:602
#10 0x00007fe943c9c4f3 in KateCodeFoldingTree::deleteNode (this=0x131d340, deletedNode=0x1c85df0) at /home/tomek2/kde/kate/part/syntax/katecodefolding.h:353
#11 0x00007fe943c9abd7 in KateCodeFoldingTree::updateMapping (this=0x131d340, line=33, newColumns=..., virtualNodeIndex=-1, virtualColumn=0) at /home/tomek2/kde/kate/part/syntax/katecodefolding.cpp:1552
#12 0x00007fe943c9a812 in KateCodeFoldingTree::updateLine (this=0x131d340, line=33, regionChanges=0x7fffd5b8d7a0, updated=0x7fffd5b8d804, changed=true, colsChanged=false) at /home/tomek2/kde/kate/part/syntax/katecodefolding.cpp:1478
#13 0x00007fe943c29d50 in KateBuffer::doHighlight (this=0x131d270, startLine=23, endLine=42, invalidate=true) at /home/tomek2/kde/kate/part/document/katebuffer.cpp:715
#14 0x00007fe943c28b6d in KateBuffer::ensureHighlighted (this=0x131d270, line=42) at /home/tomek2/kde/kate/part/document/katebuffer.cpp:252
#15 0x00007fe943cc4718 in KateViewInternal::editEnd (this=0x17b39c0, editTagLineStart=22, editTagLineEnd=22, tagFrom=false) at /home/tomek2/kde/kate/part/view/kateviewinternal.cpp:3286
#16 0x00007fe943cada54 in KateView::editEnd (this=0x17b2210, editTagLineStart=22, editTagLineEnd=22, tagFrom=false) at /home/tomek2/kde/kate/part/view/kateview.cpp:1654
#17 0x00007fe943c03a9c in KateDocument::editEnd (this=0x131c830) at /home/tomek2/kde/kate/part/document/katedocument.cpp:860
#18 0x00007fe943c0cb24 in KateDocument::typeChars (this=0x131c830, view=0x17b2210, chars=...) at /home/tomek2/kde/kate/part/document/katedocument.cpp:2689
#19 0x00007fe943cc04ae in KateViewInternal::keyPressEvent (this=0x17b39c0, e=0x7fffd5b8e520) at /home/tomek2/kde/kate/part/view/kateviewinternal.cpp:2366
#20 0x00007fe943cbf569 in KateViewInternal::eventFilter (this=0x17b39c0, obj=0x17b39c0, e=0x7fffd5b8e520) at /home/tomek2/kde/kate/part/view/kateviewinternal.cpp:2164
#21 0x00007fe9527b7627 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<value optimized out>, receiver=0x17b39c0, event=0x7fffd5b8e520) at kernel/qcoreapplication.cpp:846
#22 0x00007fe9539369c1 in QApplicationPrivate::notify_helper (this=0xff4ab0, receiver=0x17b39c0, e=0x7fffd5b8e520) at kernel/qapplication.cpp:4458
#23 0x00007fe95393bc41 in QApplication::notify (this=<value optimized out>, receiver=<value optimized out>, e=0x7fffd5b8e520) at kernel/qapplication.cpp:3921
#24 0x00007fe95465a6c6 in KApplication::notify (this=0x7fffd5b8f450, receiver=0x17b39c0, event=0x7fffd5b8e520) at ../../kdeui/kernel/kapplication.cpp:311
#25 0x00007fe9527b749c in QCoreApplication::notifyInternal (this=0x7fffd5b8f450, receiver=0x17b39c0, event=0x7fffd5b8e520) at kernel/qcoreapplication.cpp:731
#26 0x00007fe9539dc3d9 in QKeyMapper::sendKeyEvent (keyWidget=0x17b39c0, grab=<value optimized out>, type=QEvent::KeyPress, code=62, modifiers=..., text=..., autorepeat=false, count=1, nativeScanCode=60, nativeVirtualKey=62, nativeModifiers=1) at kernel/qkeymapper_x11.cpp:1866
#27 0x00007fe9539dc856 in QKeyMapperPrivate::translateKeyEvent (this=0x103ade0, keyWidget=0x17b39c0, event=0x7fffd5b8f0b0, grab=false) at kernel/qkeymapper_x11.cpp:1836
#28 0x00007fe9539b772f in QApplication::x11ProcessEvent (this=0x7fffd5b8f450, event=0x7fffd5b8f0b0) at kernel/qapplication_x11.cpp:3573
#29 0x00007fe9539e0842 in x11EventSourceDispatch (s=0xff83f0, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#30 0x00007fe94e6f2bcd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007fe94e6f33a8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007fe94e6f3639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007fe9527e23ef in QEventDispatcherGlib::processEvents (this=0xf9c4f0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:422
#34 0x00007fe9539e04de in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#35 0x00007fe9527b6882 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#36 0x00007fe9527b6abc in QEventLoop::exec (this=0x7fffd5b8f3b0, flags=...) at kernel/qeventloop.cpp:201
#37 0x00007fe9527baecb in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1008
#38 0x00007fe955e9e2ab in kdemain (argc=1, argv=0x7fffd5b90998) at /home/tomek2/kde/kate/kate/app/katemain.cpp:377
#39 0x0000000000400846 in main (argc=1, argv=0x7fffd5b90998) at /home/tomek2/kde/build/kate/app/kate_dummy.cpp:3

Reported using DrKonqi
Comment 1 Tomasz Narloch 2011-09-29 08:34:25 UTC
This crash not exists on fresh kate from git.
Comment 2 Dominik Haumann 2012-02-19 08:35:17 UTC

*** This bug has been marked as a duplicate of bug 293934 ***