Bug 446650

Summary: Crash when adding a layer style from scratch
Product: [Applications] krita Reporter: amyspark <amy>
Component: layer stylesAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: dimula73
Priority: NOR Keywords: release_blocker
Version: 5.0.0-beta5   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description amyspark 2021-12-07 22:37:44 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

Qt5Core.dll!00007ffbe1313f98() (Origen desconocido:0)
Qt5Core.dll!00007ffbe13122dd() (Origen desconocido:0)
kritaglobal.dll!kis_assert_common(const char * assertion, const char * file, int line, bool throwException, bool isIgnorable) Line 89 (e:\krita-win\src\libs\global\kis_assert.cpp:89)
kritaglobal.dll!kis_assert_exception(const char * assertion, const char * file, int line) Line 113 (e:\krita-win\src\libs\global\kis_assert.cpp:113)
kritaui.dll!StylesSelector::addNewStyle(const QString & location, const QSharedPointer<KisPSDLayerStyle> style) Line 725 (e:\krita-win\src\libs\ui\dialogs\kis_dlg_layer_style.cpp:725)
kritaui.dll!KisDlgLayerStyle::slotNewStyle() Line 312 (e:\krita-win\src\libs\ui\dialogs\kis_dlg_layer_style.cpp:312)
kritaui.dll!KisDlgLayerStyle::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 1431 (e:\krita-win\b_msvc\libs\ui\kritaui_autogen\include_RelWithDebInfo\2NRMJ5X7RK\moc_kis_dlg_layer_style.cpp:1431)
Qt5Core.dll!00007ffbe14d1830() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1fdd3a6() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1fdd2b7() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1fddfd4() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1f2c416() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1f06bad() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1f04a39() (Origen desconocido:0)
kritaui.dll!KisApplication::notify(QObject * receiver, QEvent * event) Line 756 (e:\krita-win\src\libs\ui\KisApplication.cpp:756)
Qt5Core.dll!00007ffbe14b16f1() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1f08064() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1f5657a() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1f54600() (Origen desconocido:0)
Qt5Widgets.dll!00007ffbe1f06bad() (Origen desconocido:0)


STEPS TO REPRODUCE
1. Ensure there's no "CustomStyles.asl" existing file.
2. Create a new layer style.

OBSERVED RESULT
Crash:
(3) QSqlQuery::value: not positioned on a valid record
KoResourceSP KisResourceLocator::resource "C:/Users/Amalia/AppData/Roaming/krita/" "" "" was not found
ASSERT (krita): "m_resourceModel->resourceForId(style->resourceId())" in file E:\krita-win\src\libs\ui\dialogs\kis_dlg_layer_style.cpp, line 725


EXPECTED RESULT
Resource being added successfully.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Dmitry Kazakov 2021-12-09 09:52:10 UTC
This MR should fix this bug: https://invent.kde.org/graphics/krita/-/merge_requests/1214
Comment 2 Dmitry Kazakov 2021-12-09 13:22:29 UTC
Git commit d85b9a964f2182a9d6e45a5d11bebcd0b1dde1f4 by Dmitry Kazakov.
Committed on 09/12/2021 at 13:13.
Pushed by dkazakov into branch 'master'.

Fix assert when adding the first layers style into the Krita's storage

When importing a layers style via importing its storage, its physical
representation in memory as KoResource, obviously, changes.

M  +6    -1    libs/ui/dialogs/kis_dlg_layer_style.cpp

https://invent.kde.org/graphics/krita/commit/d85b9a964f2182a9d6e45a5d11bebcd0b1dde1f4
Comment 3 Dmitry Kazakov 2021-12-09 13:30:24 UTC
Git commit eb7550cdb9b51af9847914e0b5008372fc1be7fb by Dmitry Kazakov.
Committed on 09/12/2021 at 13:25.
Pushed by dkazakov into branch 'krita/5.0'.

Fix assert when adding the first layers style into the Krita's storage

When importing a layers style via importing its storage, its physical
representation in memory as KoResource, obviously, changes.

M  +6    -1    libs/ui/dialogs/kis_dlg_layer_style.cpp

https://invent.kde.org/graphics/krita/commit/eb7550cdb9b51af9847914e0b5008372fc1be7fb