Bug 275458 - Debug version crashes due to QWidget issue
Summary: Debug version crashes due to QWidget issue
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: SVN
Platform: MacPorts macOS
: NOR crash
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-12 12:08 UTC by Marko Käning
Modified: 2013-01-26 16:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Käning 2011-06-12 12:08:23 UTC
Version:           SVN trunk (using KDE 4.6.3) 
OS:                OS X

I build the QT libraries in their debug version to be able to hunt another bug on MacOSX (http://trac.macports.org/ticket/28410) and found another issue with KMyMoney4 when running it in gdb:
---
(gdb) continue
QWidget: Must construct a QApplication before a QPaintDevice
Program received signal:  “SIGABRT”.
(gdb) 
---
It looks like KMM somehow tries to draw without having the application object up and running at the time. I am wondering whether this might be related to https://bugs.kde.org/show_bug.cgi?id=256913

Reproducible: Always

Steps to Reproduce:
install QT4-mac debug version (4.7.3)
run KMM4 in dbg

Actual Results:  
SIGABRT
Comment 1 Marko Käning 2011-06-12 12:12:19 UTC
The crash is happening in setupGUI() at the end of KMyMoneyApp::initActions(void):


(gdb) bt f
#0  0x0000000102083da2 in __kill ()
No symbol table info available.
#1  0x0000000102083d94 in kill ()
No symbol table info available.
#2  0x0000000102149520 in raise ()
No symbol table info available.
#3  0x00000001021730f3 in abort ()
No symbol table info available.
#4  0x000000011d14e0d6 in qt_message_output (msgType=QtFatalMsg, buf=0x104ed94c8 "QWidget: Must construct a QApplication before a QPaintDevice") at global/qglobal.cpp:2282
No locals.
#5  0x000000011d14e2ae in qt_message (msgType=QtFatalMsg, msg=0x11c5fc388 "QWidget: Must construct a QApplication before a QPaintDevice", ap=0x7fff5fbfc6e0) at global/qglobal.cpp:2328
	buf = {
  static shared_null = {
    ref = {
      _q_value = 754
    }, 
    alloc = 0, 
    size = 0, 
    data = 0x10367d2b8 "", 
    array = ""
  }, 
  static shared_empty = {
    ref = {
      _q_value = 1
    }, 
    alloc = 0, 
    size = 0, 
    data = 0x11d482758 "", 
    array = ""
  }, 
  d = 0x104ed94b0
}
#6  0x000000011d14e3c4 in qFatal (msg=0x11c5fc388 "QWidget: Must construct a QApplication before a QPaintDevice") at global/qglobal.cpp:2511
	ap = {{
    gp_offset = 8, 
    fp_offset = 48, 
    overflow_arg_area = 0x7fff5fbfc7c0, 
    reg_save_area = 0x7fff5fbfc700
  }}
#7  0x000000011bdf2ed1 in QWidgetPrivate::QWidgetPrivate (this=0x104ed6d40, version=263939) at kernel/qwidget.cpp:310
No locals.
#8  0x000000011be038eb in QWidget::QWidget (this=0x104ed6c00, parent=0x0, f=@0x7fff5fbfc8a0) at kernel/qwidget.cpp:1135
No locals.
#9  0x000000011bd1c605 in QDesktopWidget::QDesktopWidget (this=0x104ed6c00) at kernel/qdesktopwidget_mac.mm:157
No locals.
#10 0x000000011bd87bb8 in QApplication::desktop () at kernel/qapplication.cpp:3228
No locals.
#11 0x000000011bd0de02 in flipYCoordinate (y=819) at qt_cocoa_helpers_mac_p.h:175
No locals.
#12 0x000000011bd17588 in flipPoint (p=@0x7fff5fbfcaa0) at kernel/qt_cocoa_helpers_mac.mm:735
No locals.
#13 0x000000011bd1115a in -[QCocoaWindowDelegate windowDidMove:] (self=0x10593d900, _cmd=0x7fff8077f7c1, notification=0x104ed6610) at kernel/qcocoawindowdelegate_mac.mm:229
	window = (NSWindow *) 0x11dc27850
	newRect = {
  origin = {
    x = 586, 
    y = 697
  }, 
  size = {
    width = 1387, 
    height = 122
  }
}
	qwidget = (QWidget *) 0x105979b70
	qtPoint = {
  yp = 0, 
  xp = 0
}
	oldRect = (const QRect &) @0x7fff87eb625d: {
  y1 = -1319355008, 
  x1 = 1946216721, 
  y2 = 2105755671, 
  x2 = -2079391584
}
#14 0x00007fff871708ea in _nsnote_callback ()
No symbol table info available.
#15 0x00007fff87f0c000 in __CFXNotificationPost ()
No symbol table info available.
#16 0x00007fff87ef8578 in _CFXNotificationPostNotification ()
No symbol table info available.
#17 0x00007fff8716784e in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
No symbol table info available.
#18 0x00007fff800285c8 in -[NSWindow _setFrameCommon:display:stashSize:] ()
No symbol table info available.
#19 0x00007fff8016e733 in -[NSWindow setFrameOrigin:] ()
No symbol table info available.
#20 0x00000001037bcb2e in QWidgetPrivate::setGeometry_sys ()
No symbol table info available.
#21 0x000000010386ea43 in QWidget::resize ()
No symbol table info available.
#22 0x000000010386eb67 in QWidget::adjustSize ()
No symbol table info available.
#23 0x0000000101803523 in KXmlGuiWindow::setupGUI ()
No symbol table info available.
#24 0x00000001018036db in KXmlGuiWindow::setupGUI ()
No symbol table info available.
#25 0x000000010003f71b in KMyMoneyApp::initActions (this=0x105979b70) at /opt/macports-test/var/macports/build/_Users_marko_WC_MacPorts_ports_kde_kmymoney4-devel/work/kmymoney/kmymoney/kmymoney.cpp:1050
Comment 2 Marko Käning 2011-06-12 12:21:50 UTC
Could it be that this is a KDE issue, since the crash actually happens in KXmlGuiWindow()????

Looks like this needs to be communicated upstream...
Comment 3 Marko Käning 2011-06-12 12:40:45 UTC
Reported upstream as https://bugs.kde.org/show_bug.cgi?id=275460
Comment 4 Marko Käning 2011-06-12 19:25:03 UTC
My upstream bug report has been dismissed as invalid, since the error message tells clearly enough what went wrong. So, this means that KMyMoney itself misbehaves!

(Perhaps the warning messages described in https://bugs.kde.org/show_bug.cgi?id=256913 are already an indication of the real problem here.)
Comment 5 Marko Käning 2011-06-13 00:51:01 UTC
Is this due to Apple' system frameworks? (http://developer.qt.nokia.com/wiki/Mac_OS_X_Troubleshooting)
Comment 6 Marko Käning 2011-06-13 12:37:22 UTC
It looks like this could be a compiler issue as hinted out in 

http://developer.qt.nokia.com/forums/viewthread/6748/

which could also be explained why all the warnings during startup (https://bugs.kde.org/show_bug.cgi?id=256913) only seem to pop up on MacOSX but not on Linux.

I wonder whether somewhere in KMM's startup procedure QIcons or something similar get created, which could be the culprit for this crash...
Comment 7 Marko Käning 2011-06-13 13:12:22 UTC
I saw only now that the above mentioned warnings pop up only after the application has already appeared on the screen. The data is already read from the file:
--- 
KMyMoney iCalendar plugin loaded
reading file
start parsing file
startDocument
reading accounts
reading transactions
reading securities
reading currencies
reading prices
reading reports
endDocument
QPainter::begin: Widget painting can only begin as a result of a paintEvent
QPainter::translate: Painter not active
QPainter::setClipRect: Painter not active
QPainter::font: Painter not active
QPainter::setFont: Painter not active
QPainter::setPen: Painter not active
QPainter::font: Painter not active
Comment 8 Marko Käning 2011-06-13 19:14:49 UTC
Finally I was able to debug into KDE's libs. There I've found that the crash gets triggered when KDE goes into QT's adjustSize() (because the window is hidden):
---
void KXmlGuiWindow::setupGUI( const QSize & defaultSize, StandardWindowOptions options, const QString & xmlfile ) {
.
.
.
    if (initialGeometrySet()) {
        // Do nothing...
    }
    else if (d->defaultSize.isValid()) {
        resize(d->defaultSize);
    }
    else if (isHidden()) {
>     adjustSize();
    }
---
(See '>' in first column above for execution pointer at crash.)
Comment 10 Marko Käning 2013-01-26 16:02:46 UTC
Improvements of MacPorts' port qt4-mac now allows proper debugging also on Mac OS X.