New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

segfault when selecting items in the history menu

Report bugs here

segfault when selecting items in the history menu

Postby gennady » Sun Nov 01, 2009 4:36 am

Segmentation fault happens when selecting an item from the History menu. It happens not every single time; it may require few attempts to crash the application.

Last build from Git, Qt 4.5.0, Ubuntu Linux, 2.6.28-16-generic, x86_64

gdb says
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f6b5778b750 (LWP 9449)]
0x00007f6b54df83ce in QMenu::findIdForAction () from /usr/lib/libQtGui.so.4
(gdb) bt
#0  0x00007f6b54df83ce in QMenu::findIdForAction () from /usr/lib/libQtGui.so.4
#1  0x00007f6b54df98db in ?? () from /usr/lib/libQtGui.so.4
#2  0x00007f6b54dffa0e in ?? () from /usr/lib/libQtGui.so.4
#3  0x00007f6b54a218cf in QWidget::event () from /usr/lib/libQtGui.so.4
#4  0x00007f6b54e021cb in QMenu::event () from /usr/lib/libQtGui.so.4
#5  0x00007f6b549d078d in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#6  0x00007f6b549d90da in QApplication::notify () from /usr/lib/libQtGui.so.4
#7  0x00007f6b541de75c in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#8  0x00007f6b549d8328 in QApplicationPrivate::sendMouseEvent () from /usr/lib/libQtGui.so.4
#9  0x00007f6b54a41fd4 in ?? () from /usr/lib/libQtGui.so.4
#10 0x00007f6b54a40a88 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#11 0x00007f6b54a69464 in ?? () from /usr/lib/libQtGui.so.4
#12 0x00007f6b519a720a in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#13 0x00007f6b519aa8e0 in ?? () from /usr/lib/libglib-2.0.so.0
#14 0x00007f6b519aaa7c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#15 0x00007f6b54207e6f in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#16 0x00007f6b54a68bef in ?? () from /usr/lib/libQtGui.so.4
#17 0x00007f6b541dd002 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#18 0x00007f6b541dd3cd in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#19 0x00007f6b541df694 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#20 0x0000000000440d66 in main ()     


I have investigated the problem.

It seems that this segfault happens because, while handling the event, we delete actions from the history menu.

It goes like this:
- user clicks on an item in History menu;
- MainWindow::on_menuHistory_triggered is called;
- it calls MainWindow::showTranslationFor;
- showTranslationFor calls History.addItem;
- addItem emits itemsChanged() and MainWindow::historyChanged() is called;
- in historyChanged all actions from menu History are deleted ui.menuHistory->clear();

So, it looks like Qt doesn't like when an action is deleted while it is still being processed.

I tried to fix it, just for fun :), you know.
Here is the patch: http://github.com/gennady/goldendict/co ... 1c64774f70
gennady
 
Posts: 6
Joined: Fri Jul 31, 2009 10:47 pm
Location: Bryansk, Russia

Re: segfault when selecting items in the history menu

Postby ikm » Sun Nov 01, 2009 4:33 pm

I've commited a bit simpler fix -- check if it fixes the problem.
ikm
Автор GoldenDict
 
Posts: 1595
Joined: Wed Feb 04, 2009 10:40 am

Re: segfault when selecting items in the history menu

Postby gennady » Sun Nov 01, 2009 5:40 pm

Yeah, it works well.
gennady
 
Posts: 6
Joined: Fri Jul 31, 2009 10:47 pm
Location: Bryansk, Russia


Return to Bugs

Who is online

Users browsing this forum: Google [Bot] and 2 guests