Bug 173071

Summary: Crash at KTextEdit::mousePopupMenu() when using setTextInteractionFlags(Qt::NoTextInteraction)
Product: [Frameworks and Libraries] kdelibs Reporter: Philipp Wagner <mail>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: finex
Priority: NOR    
Version: 4.1   
Target Milestone: ---   
Platform: openSUSE   
OS: Unspecified   
Latest Commit: Version Fixed In:

Description Philipp Wagner 2008-10-18 00:07:03 UTC
Version:            (using KDE 4.1.2)
Installed from:    SuSE RPMs

If you have a KTextEdit created like that:

KTextEdit *kte = new KTextEdit(this);
kte->setTextInteractionFlags(Qt::NoTextInteraction);

and then right-click on the edit field, the method KTextEdit::mousePopupMenu() gets called (http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/ktextedit_8cpp-source.html#l00394)

By defining that we want no interaction, Qt returns a NP at createStandardContextMenu();

The application crashes when calling connect():

QObject::connect: Cannot connect (null)::triggered ( QAction* ) to KTextEdit::menuActivated( QAction* )

I don't have a recent SVN checkout here to provide a patch, but it should be done with a simple check for a NP.
Comment 1 FiNeX 2008-11-19 20:25:54 UTC
Changed severity to "crash". I hope to have selected only the right bugs (>100) :-)
Comment 2 Rob Buis 2008-11-26 15:26:36 UTC
SVN commit 889338 by buis:

createStandardContextMenu can return 0 when Qt::NoTextInteraction flag is set, so
do not crash on that.
BUG: 173071


 M  +5 -2      ktextedit.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=889338