https://bugs.kde.org/show_bug.cgi?id=509197

            Bug ID: 509197
           Summary: segfault when loading a puzzle
    Classification: Applications
           Product: palapeli
      Version First unspecified
       Reported In:
          Platform: Kubuntu
                OS: Linux
            Status: REPORTED
          Severity: critical
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

SUMMARY
After upgrading to Ubuntu 25.04 and creating a new puzzle with 2 pieces holers,
Palapeli crashed with a segmentation fault on reloading this puzzle.
Palapeli Version is 2.1.25043, from official Ubuntu depot. 

STEPS TO REPRODUCE
1. Create a puzzle
2. Create some holders
3. Close the puzzle
4. Reload the puzzle

OBSERVED RESULT
>From KDE: Application not responding dialog or just closing.
>From shell: segmentation fault message

ADDITIONAL INFORMATION
The fault is in the puzzle ".save" file, where "N_Holders" is saved with value
"-1"!
I could not find why an could also not reproduce it since, but have made a
small workaround patch to be able to load the puzzle in this situation (it's
bad to loose a 1'000 pieces puzzle with contour and some background pieces
already sorted). Patch for actual main branch in KDEInvent git:

Index: src/engine/gameplay.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/engine/gameplay.cpp b/src/engine/gameplay.cpp
--- a/src/engine/gameplay.cpp   (revision
ad651690fcb6890e7fa23e22d037e20ee3081c2c)
+++ b/src/engine/gameplay.cpp   (date 1757168192413)
@@ -880,9 +880,19 @@

                // Re-create the saved piece-holders, if any.
                m_currentHolder = nullptr;
-               for (int groupID = 1; groupID <= nHolders; groupID++) {
+
+               // BUG: in new format, number of holders is saved with value
"-1"
+               // Recreate holders by trying
+               for (int groupID = 1; (nHolders == -1) || (groupID <=
nHolders); groupID++) {
                        KConfigGroup holder (&savedConfig,
                                       
QStringLiteral("Holder_%1").arg(groupID));
+
+                       // BUG: if this group doesn't exist, we reached the end
of the list
+                       if (not holder.exists())
+                       {
+                                       break;
+                       }
+
                        // Re-create a piece-holder and add it to m_viewList.
                        qCDebug(PALAPELI_LOG) << "RE-CREATE HOLDER"
                                 << QStringLiteral("Holder_%1").arg(groupID) <<
"name"

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to