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

Albert Astals Cid <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Latest Commit|                            |https://invent.kde.org/grap
                   |                            |hics/okular/-/commit/1c0804
                   |                            |8b29e0d0106b47c8493b2ed8c21
                   |                            |01668a7

--- Comment #8 from Albert Astals Cid <[email protected]> ---
Git commit 1c08048b29e0d0106b47c8493b2ed8c2101668a7 by Albert Astals Cid, on
behalf of Nick Liu.
Committed on 01/09/2026 at 17:17.
Pushed by aacid into branch 'release/26.08'.

Fix dangling form field page pointers after saving

`Document::swapBackingFile()` keeps the old Page objects alive and
adopts the newly generated `PagePrivate` contents into them, deleting
the temporary new `Page` objects afterwards.  The freshly created
form fields still pointed at those temporary pages, though, so any
later `FormField::page()` call used freed memory. Specifically,
toggling a form button after saving crashed in the
`EditFormButtonsCommand` constructor (or recorded a garbage page
number that crashed `refreshInternalPageReferences` on the next save).

This change

* makes form fields store the `PagePrivate`, the object the swap
  transplants into the surviving `Page`, so the fields stay valid
  without anything having to re-point them (`Annotation` already
  stores its page the same way), and
* adds a test covering the toggle/save/toggle/save sequence.
Related: bug 505130
(cherry picked from commit 7fd85b3361def1860155806dc71c48d237411298)

M  +89   -0    autotests/editformstest.cpp
M  +2    -1    core/form.cpp
M  +2    -1    core/form_p.h
M  +1    -1    core/page.cpp

https://invent.kde.org/graphics/okular/-/commit/1c08048b29e0d0106b47c8493b2ed8c2101668a7

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

Reply via email to