Bug 289334 - Crash on Editting Ingredients
Summary: Crash on Editting Ingredients
Status: RESOLVED FIXED
Alias: None
Product: krecipes
Classification: Applications
Component: general (show other bugs)
Version: 2.0-beta1
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-19 05:24 UTC by Frank Luet
Modified: 2016-04-01 13:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.2
Sentry Crash Report:


Attachments
New crash information added by DrKonqi (4.03 KB, text/plain)
2012-02-18 18:35 UTC, Murray Thrift
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Luet 2011-12-19 05:24:19 UTC
Application: krecipes (2.0-beta1)
KDE Platform Version: 4.4.5 (KDE 4.4.5)
Qt Version: 4.6.3
Operating System: Linux 2.6.32-5-amd64 x86_64
Distribution: Debian GNU/Linux 6.0.3 (squeeze)

-- Information about the crash:
Peridically while moving ingredients up and down in the list and deleting or adding new ones the application crashes. If you save periodically you can recover some of your work and a new crash may occur at a different point, perhaps even a different recipe.

The crash can be reproduced some of the time.

 -- Backtrace:
Application: Krecipes (krecipes), signal: Segmentation fault
[KCrash Handler]
#5  0x00007f0220440023 in KCompTreeNode::remove(QString const&) () from /usr/lib/libkdeui.so.5
#6  0x00007f02204402de in KCompletion::removeItem(QString const&) () from /usr/lib/libkdeui.so.5
#7  0x00000000004bdfae in RecipeInputDialog::removeIngredient (this=0x16d4e50) at /tmp/buildd/krecipes-2.0~beta1/src/dialogs/recipeinputdialog.cpp:919
#8  0x00000000004c274d in RecipeInputDialog::qt_metacall (this=0x16d4e50, _c=QMetaObject::InvokeMetaMethod, _id=3211265, _a=0x7fff2d4a9290)
    at /tmp/buildd/krecipes-2.0~beta1/obj-x86_64-linux-gnu/src/recipeinputdialog.moc:147
#9  0x00007f021c38c2e6 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#10 0x00007f021bdb6422 in QAbstractButton::clicked(bool) () from /usr/lib/libQtGui.so.4
#11 0x00007f021bace7db in ?? () from /usr/lib/libQtGui.so.4
#12 0x00007f021bacf67b in ?? () from /usr/lib/libQtGui.so.4
#13 0x00007f021bacf8ec in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#14 0x00007f021b76f632 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#15 0x00007f021b71932c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#16 0x00007f021b71ffdb in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#17 0x00007f02203d1796 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#18 0x00007f021c37909c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#19 0x00007f021b71f1be in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#20 0x00007f021b79f07b in ?? () from /usr/lib/libQtGui.so.4
#21 0x00007f021b79d9dc in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#22 0x00007f021b7c95a2 in ?? () from /usr/lib/libQtGui.so.4
#23 0x00007f02160556f2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#24 0x00007f0216059568 in ?? () from /lib/libglib-2.0.so.0
#25 0x00007f021605971c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#26 0x00007f021c3a26b3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#27 0x00007f021b7c919e in ?? () from /usr/lib/libQtGui.so.4
#28 0x00007f021c3779c2 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#29 0x00007f021c377d9c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#30 0x00007f021c37ca2b in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#31 0x000000000043a5c7 in main (argc=<value optimized out>, argv=<value optimized out>) at /tmp/buildd/krecipes-2.0~beta1/src/main.cpp:91

Reported using DrKonqi
Comment 1 Murray Thrift 2012-02-18 18:35:13 UTC
Created attachment 68909 [details]
New crash information added by DrKonqi

krecipes (2.0-beta1) on KDE Platform 4.5.5 (KDE 4.5.5) using Qt 4.7.0

- What I was doing when the application crashed: Attempting to edit ingredients in a recipe. This involved adding a corrected item, moving it up in the ingredients list and removing the incorrect item. The crash occurs when I attempt to remove the incorrect item.

-- Backtrace (Reduced):
#7  0xb6fa9fdf in KCompTreeNode::remove(QString const&) () from /usr/lib/libkdeui.so.5
#8  0xb6faa2a0 in KCompletion::removeItem(QString const&) () from /usr/lib/libkdeui.so.5
#9  0x08100eb2 in RecipeInputDialog::removeIngredient (this=0x86b9730) at /build/buildd/krecipes-2.0~beta1/src/dialogs/recipeinputdialog.cpp:919
#10 0x081058ed in RecipeInputDialog::qt_metacall (this=0x86b9730, _c=QMetaObject::InvokeMetaMethod, _id=27, _a=0xbf85b918) at /build/buildd/krecipes-2.0~beta1/obj-i686-linux-gnu/src/recipeinputdialog.moc:147
[...]
[...]
#13 0xb4fe0019 in QAbstractButton::clicked(bool) () from /usr/lib/libQtGui.so.4
Comment 2 Albert Astals Cid 2015-02-21 14:53:41 UTC
At some point i could reproduce this and then not.
The steps were easy, move the first ingredient down and then delete it.
Can you check if you have a recipe in your system that makes it crash?

Now the technical reason:
the problem is that RecipeInputDialog::removeIngredient calls loadedRecipe->ingList.findSubstitute that just returns a bogus IngredientData because the groupIds of the ingredients didn't match after moving them up/down. And from there it would just crash, one easy way is not call findSubstitute since ing_item->ingredient() will already give you the ingredient so we can just use that for instructionsEdit->removeCompletionItem and loadedRecipe->ingList.removeSubstitute, the problem i fear is that loadedRecipe->ingList.removeSubstitute will just have the same problem, i.e. you won't be relly be able to delete the ingredient, seems like something would be corrupted in the recipe itself.
Comment 3 José Manuel Santamaría Lema 2016-04-01 13:27:33 UTC
Git commit 021976224c167003032e4af08df88369411275f2 by José Manuel Santamaría Lema.
Committed on 01/04/2016 at 11:01.
Pushed by joselema into branch 'master'.

Set the new editor as default.

There are still things to be implemented/fixed in the new editor but it's
good enough for git/master.
Related: bug 285826
FIXED-IN: 2.2

M  +4    -4    src/dialogs/recipeinput/recipeinputdialog.cpp

http://commits.kde.org/krecipes/021976224c167003032e4af08df88369411275f2