Bug 341301 - kate crashes when printing
Summary: kate crashes when printing
Status: RESOLVED UPSTREAM
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: Git
Platform: MacPorts macOS
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-26 18:34 UTC by RJVB
Modified: 2015-07-26 17:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
File provoking the crash when printing (1.26 KB, text/plain)
2014-11-26 18:35 UTC, RJVB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RJVB 2014-11-26 18:34:40 UTC
There appears to be a class of files with which Kate (and KDevelop) crash when trying to print them.

Reproducible: Always

Steps to Reproduce:
1. Open a file with "offending" content
2. Try to print the file


Actual Results:  
Kate crashes with a backtrace like this:

Process 15621 stopped
* thread #1: tid = 0x75c36, 0x0000000101283430 QtGui`qt_mac_create_imagemask(pixmap=<unavailable>, sr=0x00007fff5fbfcc30) + 752 at qpixmap_mac.cpp:1090, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x92010000)
    frame #0: 0x0000000101283430 QtGui`qt_mac_create_imagemask(pixmap=<unavailable>, sr=0x00007fff5fbfcc30) + 752 at qpixmap_mac.cpp:1090
   1087     for(int y = sy, offset=0; y < sh; ++y) {
   1088         srow = sptr + (y * (sbpr / 4));
   1089         for(int x = sx; x < sw; ++x)
-> 1090             *(dptr+(offset++)) = (*(srow+x) & mask) ? 255 : 0;
   1091     }
   1092     QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, dptr, nbytes, qt_mac_cgimage_data_free);
   1093     px->cg_mask = CGImageMaskCreate(sw, sh, 8, 8, nbytes / sh, provider, 0, 0);
(lldb) bt all
* thread #1: tid = 0x75c36, 0x0000000101283430 QtGui`qt_mac_create_imagemask(pixmap=<unavailable>, sr=0x00007fff5fbfcc30) + 752 at qpixmap_mac.cpp:1090, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x92010000)
  * frame #0: 0x0000000101283430 QtGui`qt_mac_create_imagemask(pixmap=<unavailable>, sr=0x00007fff5fbfcc30) + 752 at qpixmap_mac.cpp:1090
    frame #1: 0x000000010139dafb QtGui`qt_mac_draw_pattern(info=0x000000011203ac00, c=0x0000000112046280) + 907 at qpaintengine_mac.cpp:494
    frame #2: 0x00007fff93e1ca6f CoreGraphics`CGPatternDelegateDrawPattern + 66
    frame #3: 0x000000010935475a libPDFRIP.A.dylib`PDFPatternEmitDefinition + 1299
    frame #4: 0x00000001093549c6 libPDFRIP.A.dylib`emitPatternDefinition + 14
    frame #5: 0x00007fff8b0d1382 CoreFoundation`__CFSetApplyFunction_block_invoke + 18
    frame #6: 0x00007fff8b0b58fc CoreFoundation`CFBasicHashApply + 124
    frame #7: 0x00007fff8b0d133d CoreFoundation`CFSetApplyFunction + 173
    frame #8: 0x0000000109354993 libPDFRIP.A.dylib`PDFPatternSetEmitDefinitions + 71
    frame #9: 0x000000010934aa0c libPDFRIP.A.dylib`emit_page_resources(PDFDocument*) + 59
    frame #10: 0x000000010934a9b0 libPDFRIP.A.dylib`PDFDocumentEndPage + 73
    frame #11: 0x0000000109349570 libPDFRIP.A.dylib`pdf_EndPage + 17
    frame #12: 0x00007fff8f7e7ea3 PrintCore`pdfSpoolingEndPage(void*, void*) + 345
    frame #13: 0x00007fff8f7df835 PrintCore`PJCEndPage(OpaquePMPrintSession*) + 40
    frame #14: 0x00007fff8f7bd3b6 PrintCore`PMSessionEndPageNoDialog + 80
    frame #15: 0x00000001011812c7 QtGui`QMacPrintEngine::end() + 103
    frame #16: 0x00000001012dad0e QtGui`QPainter::end(this=<unavailable>) + 142 at qpainter.cpp:1963
    frame #17: 0x000000010dcd0159 libkatepartinterfaces.4.dylib`KatePrinter::print(doc=<unavailable>) + 17097 at kateprinter.cpp:669
    frame #18: 0x000000010db2433a libkatepartinterfaces.4.dylib`KateDocument::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) [inlined] KateDocument::print() + 1994 at katedocument.cpp:1855
    frame #19: 0x000000010db24332 libkatepartinterfaces.4.dylib`KateDocument::qt_static_metacall(_o=0x00000001036eb760, _c=<unavailable>, _id=<unavailable>, _a=0x00007fff5fbfdd80) + 1986 at katedocument.moc:267
    frame #20: 0x000000010276b3fd QtCore`QMetaObject::activate(sender=0x000000010e7b42c0, m=<unavailable>, local_signal_index=<unavailable>, argv=<unavailable>) + 1693 at qobject.cpp:3567
    frame #21: 0x00000001011bd419 QtGui`QAction::activate(QAction::ActionEvent) [inlined] QAction::triggered(this=0x000000010e7b42c0, _t1=false) + 233 at moc_qaction.cpp:277
    frame #22: 0x00000001011bd3f1 QtGui`QAction::activate(this=0x000000010e7b42c0, event=<unavailable>) + 193 at qaction.cpp:1257
    frame #23: 0x0000000101171c91 QtGui`-[QCocoaMenuLoader qtDispatcherToQAction:] + 65
    frame #24: 0x00007fff8e38b260 AppKit`-[NSApplication sendAction:to:from:] + 327
    frame #25: 0x00007fff8e3a61c8 AppKit`-[NSMenuItem _corePerformAction] + 394
    frame #26: 0x00007fff8e3a5f04 AppKit`-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 117
    frame #27: 0x00007fff8e3a507c AppKit`-[NSMenu performKeyEquivalent:] + 289
    frame #28: 0x00007fff8e3a18e1 AppKit`-[NSApplication _handleKeyEquivalent:] + 822
    frame #29: 0x00007fff8e310acc AppKit`-[NSApplication sendEvent:] + 3293
    frame #30: 0x00000001011720fe QtGui`-[QNSApplication sendEvent:] + 78
    frame #31: 0x00007fff8e1609f9 AppKit`-[NSApplication run] + 646
    frame #32: 0x000000010117aba0 QtGui`QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 528
    frame #33: 0x00000001027508ad QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QFlags(this=0x00007fff00000024) + 9 at qglobal.h:2319
    frame #34: 0x00000001027508a4 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QFlags(this=0x00007fff00000024) at qglobal.h:2319
    frame #35: 0x00000001027508a4 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QFlags<QEventLoop::ProcessEventsFlag>::operator|(this=<unavailable>, f=EventLoopExec) const + 59 at qeventloop.cpp:149
    frame #36: 0x0000000102750869 QtCore`QEventLoop::exec(this=0x00007fff5fbfe540, flags=(i = 0)) + 409 at qeventloop.cpp:204
    frame #37: 0x0000000102753ac7 QtCore`QCoreApplication::exec() + 199 at qcoreapplication.cpp:1225
    frame #38: 0x0000000100011693 libkdeinit4_kate.dylib`kdemain(argc=<unavailable>, argv=<unavailable>) + 13507 at katemain.cpp:381
    frame #39: 0x00007fff8d6075fd libdyld.dylib`start + 1

  thread #2: tid = 0x75c57, 0x00007fff8cb86662 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x00007fff8cb86662 libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x00007fff905a1421 libdispatch.dylib`_dispatch_mgr_invoke + 239
    frame #2: 0x00007fff905a1136 libdispatch.dylib`_dispatch_mgr_thread + 52

  thread #3: tid = 0x75c58, 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8f5d6f08 libsystem_pthread.dylib`_pthread_wqthread + 330
    frame #2: 0x00007fff8f5d9fb9 libsystem_pthread.dylib`start_wqthread + 13

  thread #4: tid = 0x75c59, 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8f5d6f08 libsystem_pthread.dylib`_pthread_wqthread + 330
    frame #2: 0x00007fff8f5d9fb9 libsystem_pthread.dylib`start_wqthread + 13

  thread #5: tid = 0x75c6a, 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8f5d6f08 libsystem_pthread.dylib`_pthread_wqthread + 330
    frame #2: 0x00007fff8f5d9fb9 libsystem_pthread.dylib`start_wqthread + 13

  thread #7: tid = 0x75c6c, 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x00007fff8cb85e6a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff8f5d6f08 libsystem_pthread.dylib`_pthread_wqthread + 330
    frame #2: 0x00007fff8f5d9fb9 libsystem_pthread.dylib`start_wqthread + 13

  thread #6: tid = 0x75c70, 0x00007fff8cb859aa libsystem_kernel.dylib`__select + 10, name = 'com.apple.CFSocket.private'
    frame #0: 0x00007fff8cb859aa libsystem_kernel.dylib`__select + 10
    frame #1: 0x00007fff8b12fa03 CoreFoundation`__CFSocketManager + 867
    frame #2: 0x00007fff8f5d5899 libsystem_pthread.dylib`_pthread_body + 138
    frame #3: 0x00007fff8f5d572a libsystem_pthread.dylib`_pthread_start + 137
    frame #4: 0x00007fff8f5d9fc9 libsystem_pthread.dylib`thread_start + 13

  thread #8: tid = 0x75c80, 0x00007fff8cb81a1a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #0: 0x00007fff8cb81a1a libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00007fff8cb80d18 libsystem_kernel.dylib`mach_msg + 64
    frame #2: 0x00007fff8b0e3f15 CoreFoundation`__CFRunLoopServiceMachPort + 181
    frame #3: 0x00007fff8b0e3539 CoreFoundation`__CFRunLoopRun + 1161
    frame #4: 0x00007fff8b0e2e75 CoreFoundation`CFRunLoopRunSpecific + 309
    frame #5: 0x00007fff8e30d05e AppKit`_NSEventThread + 144
    frame #6: 0x00007fff8f5d5899 libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x00007fff8f5d572a libsystem_pthread.dylib`_pthread_start + 137
    frame #8: 0x00007fff8f5d9fc9 libsystem_pthread.dylib`thread_start + 13

  thread #9: tid = 0x75ecb, 0x00007fff8cb85a3a libsystem_kernel.dylib`__semwait_signal + 10, name = 'com.apple.appkit-heartbeat'
    frame #0: 0x00007fff8cb85a3a libsystem_kernel.dylib`__semwait_signal + 10
    frame #1: 0x00007fff88fbcdc0 libsystem_c.dylib`nanosleep + 200
    frame #2: 0x00007fff88fbccb2 libsystem_c.dylib`usleep + 54
    frame #3: 0x00007fff8e3d117d AppKit`-[NSUIHeartBeat _heartBeatThread:] + 2132
    frame #4: 0x00007fff9368776b Foundation`__NSThread__main__ + 1318
    frame #5: 0x00007fff8f5d5899 libsystem_pthread.dylib`_pthread_body + 138
    frame #6: 0x00007fff8f5d572a libsystem_pthread.dylib`_pthread_start + 137
    frame #7: 0x00007fff8f5d9fc9 libsystem_pthread.dylib`thread_start + 13




Expected Results:  
A printed file and no crash.

I'm attaching a file for which the crash occurs, systematically.

I've started testing copying bits and pieces from this document into an empty document: the crash occurred when I added the "configure {}" block. I have not done this systematically (but the first few lines printed OK).
Comment 1 RJVB 2014-11-26 18:35:38 UTC
Created attachment 89735 [details]
File provoking the crash when printing
Comment 2 RJVB 2014-11-26 18:41:57 UTC
It appears that the offending lines are

    reinplace "s|prefix = /usr|prefix = ${prefix}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/qtchooser/Makefile
    reinplace "s|\$(MAKE)|\$(MAKE) \"CXXFLAGS=${configure.cflags}\"|g" ${worksrcpath}/Makefile
Comment 3 Christoph Feck 2014-11-26 20:56:20 UTC
I suspect this crash is caused by QMacPrintEngine, somehow failing to handle the callback from CGPatternDelegateDrawPattern.
Comment 4 RJVB 2014-11-26 21:48:06 UTC
In other words, I ought to be reporting this upstream according to you? (I only did it here because the crash isn't systematic and from what I've seen occurs only with Kate/part.)
Comment 5 Christoph Cullmann 2015-07-26 17:53:23 UTC
Yes, please report that to Qt, it is no KTextEditor bug.