[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Invalid reads in handling of accels
From:       Waldo Bastian <bastian () kde ! org>
Date:       2002-07-18 18:17:44
[Download RAW message or body]

With the latest qt-copy (post Qt-3.05 development snapshot I believe?) 
valgrind reports invalid reads within Qt code (See backtrace below)
I have not tested other Qt versions.

The problem is that Qt expects the parent of the QAccel to be a widget, but in 
the case of KDE it is usually a KActionCollection

Running a KDE application with the attached patch to qaccel.cpp highlights the 
problem. (Just press a few keys)

Cheers,
Waldo

==18914== Invalid read of size 4
==18914==    at 0x40FEC3FC: ??? (.moc/debug-mt/../../kernel/qwidget.h:674)
==18914==    by 0x40C1F4DA: QAccel::eventFilter(QObject *, QEvent *) 
(kernel/qaccel.cpp:493)
==18914==    by 0x40C69F1E: QObject::activate_filters(QEvent *) 
(kernel/qobject.cpp:779)
==18914==    by 0x40C69D35: QObject::event(QEvent *) (kernel/qobject.cpp:655)
==18914==    by 0x40C9AD55: QWidget::event(QEvent *) (kernel/qwidget.cpp:4220)
==18914==    by 0x40D31FE4: QMainWindow::event(QEvent *) 
(widgets/qmainwindow.cpp:1609)
==18914==    by 0x40C23979: QApplication::internalNotify(QObject *, QEvent *) 
(kernel/qapplication.cpp:2209)
==18914==    by 0x40C236D8: QApplication::notify(QObject *, QEvent *) 
(kernel/qapplication.cpp:2157)
==18914==    by 0x408B08B5: KApplication::notify(QObject *, QEvent *) 
(kapplication.cpp:556)
==18914==    by 0x40FE9D24: ??? 
(.moc/debug-mt/../../kernel/qapplication.h:444)
==18914==    by 0x40BCFDF9: QETWidget::translateKeyEvent(_XEvent const *, 
bool) (kernel/qapplication_x11.cpp:5419)
==18914==    by 0x40BCB78B: QApplication::x11ProcessEvent(_XEvent *) 
(kernel/qapplication_x11.cpp:3613)
==18914==    by 0x40BCA019: QApplication::processNextEvent(bool) 
(kernel/qapplication_x11.cpp:3090)
==18914==    by 0x40C25614: QApplication::enter_loop(void) 
(kernel/qapplication.cpp:3089)
==18914==    by 0x40BC9F1B: QApplication::exec(void) 
(kernel/qapplication_x11.cpp:3045)
==18914==    by 0x402754E4: main (konq_main.cc:136)
==18914==    by 0x4132C7EE: __libc_start_main (in /lib/libc.so.6)
==18914==    by 0x80485E1: __libc_start_main@@GLIBC_2.0 (in 
/ext/kde-head/bin/konqueror)
==18914==    Address 0x47F88EC8 is not stack'd, malloc'd or free'd


-- 
bastian@kde.org  |   SuSE Labs KDE Developer  |  bastian@suse.com

["qaccel.patch" (text/x-diff)]

Index: qaccel.cpp
===================================================================
RCS file: /home/kde/qt-copy/src/kernel/qaccel.cpp,v
retrieving revision 1.43
diff -u -p -r1.43 qaccel.cpp
--- qaccel.cpp	2002/07/12 21:52:49	1.43
+++ qaccel.cpp	2002/07/18 18:09:45
@@ -485,6 +485,10 @@ bool QAccel::eventFilter( QObject *o, QE
 
 	/* if we live in a MDI subwindow, ignore the event if we are
 	   not the active document window */
+	if (!parent()->inherits("QWidget"))
+	{
+	   qWarning("QAccel::eventFilter: parent is %s, not a QWidget!", parent()->className());
+	}
 	QWidget* w = (QWidget*) parent();
 	while ( w && !w->testWFlags( WSubWindow ) )
 	    w = w->parentWidget( TRUE );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic