Bug 442096 - Krita crashes if SeExpr scripts are saved without a thumbnail
Summary: Krita crashes if SeExpr scripts are saved without a thumbnail
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: git master (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: amyspark
URL: https://krita-artists.org/t/krita-cra...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-06 22:52 UTC by amyspark
Modified: 2021-09-14 14:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amyspark 2021-09-06 22:52:29 UTC
SUMMARY

Krita crashes if SeExpr scripts are saved without a thumbnail. This is because I assumed that the QLabel would always contain a pixmap.

https://krita-artists.org/t/krita-crashes-while-saving-seexpr-script-with-empty-thumbnail/28511

STEPS TO REPRODUCE
    Create new document (1024x1024)
    Create new fill layer
    Choose SeExpr
    On the Options tab choose “Save New SeExpr Preset…”
    Click “Clear Thumbnail”
    Click Save - crash happens here.

OBSERVED RESULT
Krita crash:

Qt5Gui.dll!00007ffc0dabc3f6() (Origen desconocido:0)
kritaseexprgenerator.dll!KisWdgSeExprPresetsSave::savePreset() Line 154 (e:\krita-win\src\plugins\generators\seexpr\kis_wdg_seexpr_presets_save.cpp:154)
Qt5Core.dll!00007ffc0d651860() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e1e1541() (Origen desconocido:0)
Qt5Core.dll!00007ffc0d651860() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e14d1d6() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e14d0e7() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e14de04() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e09c416() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e076bad() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e074a39() (Origen desconocido:0)
kritaui.dll!KisApplication::notify(QObject * receiver, QEvent * event) Line 690 (e:\krita-win\src\libs\ui\KisApplication.cpp:690)
Qt5Core.dll!00007ffc0d631721() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e078064() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e0c637a() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e0c4400() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e076bad() (Origen desconocido:0)
Qt5Widgets.dll!00007ffc0e075c0f() (Origen desconocido:0)
kritaui.dll!KisApplication::notify(QObject * receiver, QEvent * event) Line 690 (e:\krita-win\src\libs\ui\KisApplication.cpp:690)
Qt5Core.dll!00007ffc0d631721() (Origen desconocido:0)

EXPECTED RESULT

Krita doesn't crash and saves the resource.

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

ADDITIONAL INFORMATION

Commit hash 2e95dd5, confirmed in 6ca8117f88.
Comment 1 Halla Rempt 2021-09-07 11:59:10 UTC
This should fix it...

diff --git a/plugins/generators/seexpr/kis_wdg_seexpr_presets_save.cpp b/plugins/generators/seexpr/kis_wdg_seexpr_presets_save.cpp
index b633279edd..6845cb907b 100644
--- a/plugins/generators/seexpr/kis_wdg_seexpr_presets_save.cpp
+++ b/plugins/generators/seexpr/kis_wdg_seexpr_presets_save.cpp
@@ -151,7 +151,9 @@ void KisWdgSeExprPresetsSave::savePreset()
         }
         newPreset->setFilename(presetFileName);
         newPreset->setName(presetName);
-        newPreset->setImage(presetThumbnailWidget->pixmap()->toImage());
+        if (presetThumbnailWidget->pixmap()) {
+            newPreset->setImage(presetThumbnailWidget->pixmap()->toImage());
+        }
         newPreset->setScript(m_currentConfiguration->getString("script"));
         newPreset->setDirty(false);
         newPreset->setValid(true);
Comment 2 Bug Janitor Service 2021-09-07 16:57:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1040
Comment 3 Halla Rempt 2021-09-08 07:47:58 UTC
Git commit 0636d6f1f1744a05b67deca647b56bb5bd790a4e by Halla Rempt, on behalf of L. E. Segovia.
Committed on 08/09/2021 at 07:47.
Pushed by rempt into branch 'master'.

Make SeExpr script thumbnails optional

Co-authored-by: Halla Rempt <halla@valdyas.org>

M  +4    -2    plugins/generators/seexpr/kis_wdg_seexpr_presets_save.cpp

https://invent.kde.org/graphics/krita/commit/0636d6f1f1744a05b67deca647b56bb5bd790a4e
Comment 4 amyspark 2021-09-14 14:45:33 UTC
Git commit 082e2deee1db3fe368205e0384bba9059189f795 by L. E. Segovia.
Committed on 14/09/2021 at 14:45.
Pushed by lsegovia into branch 'krita/5.0'.

Make SeExpr script thumbnails optional

Co-authored-by: Halla Rempt <halla@valdyas.org>
(cherry picked from commit 0636d6f1f1744a05b67deca647b56bb5bd790a4e)

M  +4    -2    plugins/generators/seexpr/kis_wdg_seexpr_presets_save.cpp

https://invent.kde.org/graphics/krita/commit/082e2deee1db3fe368205e0384bba9059189f795