Bug 362431 - Crash when hovering over user made floss
Summary: Crash when hovering over user made floss
Status: RESOLVED FIXED
Alias: None
Product: KXStitch
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Steve Allewell
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2016-04-28 16:08 UTC by marko.lazaric
Modified: 2016-12-04 15:45 UTC (History)
0 users

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


Attachments
The file that caused the crash. (32.69 KB, application/octet-stream)
2016-04-28 16:10 UTC, marko.lazaric
Details
Added dmc.xml (60.33 KB, text/xml)
2016-12-04 08:16 UTC, marko.lazaric
Details
Added the scheme xml file I created (2.15 KB, text/xml)
2016-12-04 08:17 UTC, marko.lazaric
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marko.lazaric 2016-04-28 16:08:36 UTC
Application: kxstitch (1.3.0)
KDE Platform Version: 4.14.19
Qt Version: 4.8.7
Operating System: Linux 4.5.1-1-ARCH x86_64
Distribution: "Arch Linux"

-- Information about the crash:
- What I was doing when the application crashed:
Hovering over a custom floss to get the information like name and number of stitches.

- Custom settings of the application:
Added a couple (5-6) new flosses to better suit my needs with random names like Black, Light gray, Gray, Light light gray...

To recreate it, try creating a floss (and add it to your sidebar) then saving. Close the current window and open a new one, then open the file you saved and try to hover over the floss you made.

The crash can be reproduced every time.

-- Backtrace:
Application: KXStitch (kxstitch), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fe9168d5880 (LWP 13951))]

Thread 2 (Thread 0x7fe902dc3700 (LWP 13952)):
#0  0x00007fe910b758b9 in g_main_context_query () from /usr/lib/libglib-2.0.so.0
#1  0x00007fe910b76077 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007fe910b7620c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007fe914e3885e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007fe914e06d51 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007fe914e070c5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007fe914cf5839 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007fe914de6ea3 in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007fe914cf812c in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007fe911ab0424 in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007fe913195cbd in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7fe9168d5880 (LWP 13951)):
[KCrash Handler]
#6  0x00007fe914d46f1e in ?? () from /usr/lib/libQtCore.so.4
#7  0x00007fe914d4731f in QString::arg(QString const&, int, QChar const&) const () from /usr/lib/libQtCore.so.4
#8  0x00007fe915366823 in KLocalizedString::subs(QString const&, int, QChar const&) const () from /usr/lib/libkdecore.so.5
#9  0x00000000004896be in ?? ()
#10 0x00007fe9141352dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#11 0x00007fe91413ce0a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#12 0x00007fe9158bb88a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#13 0x00007fe914e084dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#14 0x00007fe91413ad32 in QApplication::event(QEvent*) () from /usr/lib/libQtGui.so.4
#15 0x00007fe9141352dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#16 0x00007fe91413c136 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#17 0x00007fe9158bb88a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#18 0x00007fe914e084dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#19 0x00007fe914e3aca0 in ?? () from /usr/lib/libQtCore.so.4
#20 0x00007fe914e37eb9 in ?? () from /usr/lib/libQtCore.so.4
#21 0x00007fe910b75f07 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#22 0x00007fe910b76160 in ?? () from /usr/lib/libglib-2.0.so.0
#23 0x00007fe910b7620c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#24 0x00007fe914e3883e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#25 0x00007fe9141de336 in ?? () from /usr/lib/libQtGui.so.4
#26 0x00007fe914e06d51 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#27 0x00007fe914e070c5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#28 0x00007fe914e0ca69 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#29 0x0000000000422303 in ?? ()
#30 0x00007fe9130ce710 in __libc_start_main () from /usr/lib/libc.so.6
#31 0x00000000004229b9 in _start ()

Reported using DrKonqi
Comment 1 marko.lazaric 2016-04-28 16:10:36 UTC
Created attachment 98661 [details]
The file that caused the crash.
Comment 2 Steve Allewell 2016-04-28 18:36:53 UTC
Confirmed crash.  Will investigate.
Comment 3 marko.lazaric 2016-04-29 12:50:15 UTC
I am not sure where else to ask a question, so I shall ask it here. First of all, let me just say, thank you for making such a great application for linux! :] 

Is it possible to remove all stitches of one colour? I need this particularly because the import feature creates white stitches and I don't see any way to get rid of them, short of manually erasing each one.

Is it possible to add a floss scheme? In Croatia, the most dominant floss is "Ljubica" which has different numbers and colours from all the other 3 schemes in KXStitch. 

Thank you and have a nice day!
Comment 4 Steve Allewell 2016-04-29 15:29:24 UTC
The floss schemes are defined in an XML file.  Look at the dmc.xml in the schemes source folder for an example.

You could use that as a template and add flosses to it as needed, perhaps copying and pasting from the other schemes if they match closely.

Removing stitches of one colour can be done either using the replace colour option in the palette view which will change it to another existing colour in the palette or using the colour highlight option and then manually deleting them.

When importing you can use the ignore colour option and select a colour in the picture, e.g. white, which will then not be imported as a stitch.

Regards
Comment 5 marko.lazaric 2016-04-29 15:33:43 UTC
Thank you so much!
Comment 6 Steve Allewell 2016-12-04 00:37:27 UTC
Apologies for not addressing this sooner, but I believe I have found the cause of the problem.

The names you have assigned to the colours, e.g. 'Light blue', are they stored in the DMC xml file?  If so, can you attach that file here, if not, can you attach the xml file that you did create.

Your pattern uses the DMC scheme, but those colour names don't exist in the official version, consequently when I hover over one of your flosses, there is a search goes on in the background that looks for that colour name, but then doesn't find it in the DMC scheme, resulting in a null pointer dereference and a crash.

Regards

Steve
Comment 7 marko.lazaric 2016-12-04 08:16:15 UTC
Created attachment 102609 [details]
Added dmc.xml
Comment 8 marko.lazaric 2016-12-04 08:17:41 UTC
Created attachment 102610 [details]
Added the scheme xml file I created
Comment 9 Steve Allewell 2016-12-04 12:50:15 UTC
Mmmm, I'm a bit more confused now.
When I open your file, the information in it, is as follows:
Reading version 104
Property: "author" = QVariant(QString, "")
Property: "cellHorizontalGrouping" = QVariant(int, 20)
Property: "cellVerticalGrouping" = QVariant(int, 20)
Property: "clothCountLink" = QVariant(bool, true)
Property: "clothCountUnits" = QVariant(int, 0)
Property: "copyright" = QVariant(QString, "")
Property: "fabric" = QVariant(QString, "")
Property: "fabricColor" = QVariant(QColor, QColor(ARGB 1, 1, 1, 1))
Property: "horizontalClothCount" = QVariant(double, 16)
Property: "instructions" = QVariant(QString, "")
Property: "thickLineColor" = QVariant(QColor, QColor(ARGB 1, 0.501961, 0.501961, 0.501961))
Property: "thinLineColor" = QVariant(QColor, QColor(ARGB 1, 0.752941, 0.752941, 0.752941))
Property: "title" = QVariant(QString, "")
Property: "unitsFormat" = QVariant(int, 0)
Property: "verticalClothCount" = QVariant(double, 16)
QDataStream::operator(DocumentPalette) version 103
m_schemeName "DMC"
m_symbolLibrary "kxstitch"
currentIndex 6
documentPaletteCount 7
key: 0 "Blue" QColor(ARGB 1, 0, 0.47451, 0.796078)
key: 1 "Light blue" QColor(AHSV 1, 0.566667, 1, 1)
key: 2 "Black" QColor(AHSV 1, 0, 0, 0)
key: 3 "Light light gray" QColor(AHSV 1, -1, 0, 0.627451)
key: 4 "Light gray" QColor(AHSV 1, -1, 0, 0.478431)
key: 5 "Dark Gray" QColor(AHSV 1, -1, 0, 0.298039)
key: 6 "Gray" QColor(AHSV 1, -1, 0, 0.388235)

This tells me that the DMC scheme was used, but the colour names (after the key number) do not appear in the DMC scheme.  The other odd thing is that the QColor values are HSV for most of them instead of RGB like the first one.

Neither of the xml files contain those colour names.

Can you step through how you created the new scheme and colours and how you applied that to the pattern you created.

Can you also check in ~/.local/share/kxstitch/schemes to see if there are other xml files there.

Thanks
Comment 10 marko.lazaric 2016-12-04 13:07:11 UTC
> Can you step through how you created the new scheme and colours and how you applied that to the pattern you created.

Well it has been some time so I am not sure I can completely replicate it, but I will try. https://goo.gl/photos/AyFYYvLmW5CCgfDDA The crash happens when you hover over the orange square in the Palette in the last photo (after saving, closing and opening the saved file).

> Can you also check in ~/.local/share/kxstitch/schemes to see if there are other xml files there.

From /usr/share/apps/kxstitch/schemes/
> total 180K
> -rw-r--r-- 1 root root  59K Nov 15  2015 anchor.xml
> -rw-r--r-- 1 root root  61K Nov 15  2015 dmc.xml
> -rw-r--r-- 1 root root 2.2K May 10  2016 ljubica.xml
> -rw-r--r-- 1 root root  50K Nov 15  2015 madeira.xml
Comment 11 Steve Allewell 2016-12-04 14:30:05 UTC
Found the problem.  After creating a new floss, it was getting added to the scheme, but the scheme wasn't being saved.

Consequently it worked after initially adding it, but when KXStitch was restarted, it wasn't reading the new floss and the pattern couldn't find the colour name.

I can commit a fix to stop it happening again.

To fix any existing files, there are a couple of things you can do.
- manually add the colour names to the dmc scheme again (after the fix is applied)
- convert the pattern to another scheme and back to dmc to correct the colours using the file properties
- create your new scheme, Ljubica, change the pattern scheme to that again using file properties

Regards

Steve
Comment 12 marko.lazaric 2016-12-04 14:37:02 UTC
Okay, thanks for such a great app and have a nice day! :]
Comment 13 Steve Allewell 2016-12-04 15:45:03 UTC
Git commit 5923153154c2d2448f46f3b8c60d7b75c33e1475 by Steve Allewell.
Committed on 04/12/2016 at 15:42.
Pushed by sallewell into branch 'master'.

Fix for creation of new flosses

The creation of new flosses through the palette manager dialog were
not being saved in the scheme leading to crashes when the patterns were
reloaded.

M  +2    -0    src/NewFlossDlg.cpp

https://commits.kde.org/kxstitch/5923153154c2d2448f46f3b8c60d7b75c33e1475