Bug 513409

Summary: Okular crashes while confirming a text annotation under certain conditions
Product: [Applications] okular Reporter: Huynh Huu Long <mail-from-kde>
Component: generalAssignee: Okular developers <okular-devel>
Status: REPORTED ---    
Severity: crash    
Priority: NOR    
Version First Reported In: 25.08.3   
Target Milestone: ---   
Platform: NixOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Huynh Huu Long 2025-12-15 16:29:46 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY

Okular crashes while confirming a text annotation modal after the annotation tool has been switched via shortcut.

STEPS TO REPRODUCE
1. Open a file with okular (I tried PDF and DJVU)
2. Make sure the annotation toolbar is shown. Now it is possible to activate annotation tools with keyboard shortcuts 1 to 9. In my particular configuration the geometrical shape tool (to draw a rectangle) is assigned to 1 and the typewriter tool (to draw text) is assigned to 2.
3. Activate the typewriter tool (e.g. by pressing 2)
4. Click on the document. This opens a modal window asking for the textual content that should be placed on the document.
5. Click on the main window again (leaving the modal open) and switch the annotation tool to something that's not the typewriter tool (e.g. the rectangle tool by pressing 1)
6. Go back to the modal and confirm with Ok (it does not matter whether you have entered text or not)
7. Okular crashes

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS

Okular: 25.08.3
KDE Frameworks: 6.20.0
Qt: 6.10.1 wird verwendet und gebaut wurde mit 6.10.1
NixOS 25.11 (Xantusia) (Wayland)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.17.9
Tested compositors: Kwin, Niri

ADDITIONAL INFORMATION
Comment 1 Huynh Huu Long 2025-12-15 16:45:23 UTC
This is what I got when running `gdb $(which okular)`

$ gdb (which okular)
GNU gdb (GDB) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/long/.nix-profile/bin/okular...
(No debugging symbols found in /home/long/.nix-profile/bin/okular)
(gdb) run
Starting program: /nix/store/v6g8rfwa7b0bcnyqbz4cdgikjwbqwm4g-home-manager-path/bin/okular
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libthread_db.so.1".
process 803640 is executing new program: /nix/store/0q7alkh2dvg29sdm5mx3wfjrhfgz2wcc-okular-25.08.3/bin/.okular-wrapped
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libthread_db.so.1".
warning: File "/nix/store/5qdsnc26nv61j5rrw492f19xav2rz45v-glib-2.86.1/lib/libgobject-2.0.so.0.8600.1-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/nix/store/xm08aqdd7pxcdhm0ak6aqb1v7hw5q6ri-gcc-14.3.0-lib".
To enable execution of this file add
        add-auto-load-safe-path /nix/store/5qdsnc26nv61j5rrw492f19xav2rz45v-glib-2.86.1/lib/libgobject-2.0.so.0.8600.1-gdb.py
line to your configuration file "/home/long/.config/gdb/gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/long/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
warning: File "/nix/store/5qdsnc26nv61j5rrw492f19xav2rz45v-glib-2.86.1/lib/libglib-2.0.so.0.8600.1-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/nix/store/xm08aqdd7pxcdhm0ak6aqb1v7hw5q6ri-gcc-14.3.0-lib".
[New Thread 0x7fffee3ff6c0 (LWP 803662)]
[New Thread 0x7fffe7fff6c0 (LWP 803663)]
[New Thread 0x7fffe6ffe6c0 (LWP 803664)]
qt.multimedia.symbolsresolver: Couldn't load pipewire-0.3 library
qt.multimedia.symbolsresolver: Couldn't resolve pipewire-0.3 symbols
[New Thread 0x7fffdf1ff6c0 (LWP 803665)]
[New Thread 0x7fffde1fe6c0 (LWP 803666)]
[New Thread 0x7fffdd1fd6c0 (LWP 803667)]
[New Thread 0x7fffcbfff6c0 (LWP 803668)]
qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: Connection already associated with an application ID")
Trying to enable pgp signatures, but pgp not enabled in this build
[New Thread 0x7fffc9dff6c0 (LWP 803685)]
[New Thread 0x7fffc3fff6c0 (LWP 803686)]
[Thread 0x7fffc9dff6c0 (LWP 803685) exited]
[New Thread 0x7fffc9dff6c0 (LWP 803687)]
[Thread 0x7fffc3fff6c0 (LWP 803686) exited]
[Thread 0x7fffc9dff6c0 (LWP 803687) exited]
[New Thread 0x7fffc9dff6c0 (LWP 803688)]
[New Thread 0x7fffc3fff6c0 (LWP 803689)]
[Thread 0x7fffc9dff6c0 (LWP 803688) exited]
[New Thread 0x7fffc9dff6c0 (LWP 803690)]
[Thread 0x7fffc3fff6c0 (LWP 803689) exited]
[Thread 0x7fffc9dff6c0 (LWP 803690) exited]
[New Thread 0x7fffc9dff6c0 (LWP 803691)]
[Thread 0x7fffc9dff6c0 (LWP 803691) exited]

# This is the point where I start using the annotation tools as per reproduction steps

Thread 1 ".okular-wrapped" received signal SIGSEGV, Segmentation fault.
0x00007fffe51b88a0 in PageViewItem::pageNumber() const ()
   from /nix/store/0q7alkh2dvg29sdm5mx3wfjrhfgz2wcc-okular-25.08.3/lib/qt-6/plugins/kf6/parts/okularpart.so
(gdb)
(gdb)
(gdb) Quit