Bug 456673 - Spectacle cli segfault when using --edit-existing with other options
Summary: Spectacle cli segfault when using --edit-existing with other options
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 22.04.3
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-13 11:39 UTC by kde
Modified: 2023-11-22 13:50 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Backtrace (4.76 KB, text/plain)
2022-07-13 11:39 UTC, kde
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2022-07-13 11:39:34 UTC
Created attachment 150583 [details]
Backtrace

SUMMARY

When using spectacle in the cli, if I use the option `--edit-existing` with other options (e.g. `--region --background`), it segfaults.

I was testing spectacle via command line with the intention of reproducing the behaviour of flameshot, take a screenshot and edit it right away.


STEPS TO REPRODUCE
1. Spectacle GUI is not open.
2. Take a screenshot with this command: `spectacle --region --background --nonotify --output /tmp/shot --edit-existing /tmp/shot`.
3. Result: segfault.
4. Ensure /tmp/shot exists: `spectacle --region --background --nonotify --output /tmp/shot` (take the screenshot).
5. `file /tmp/shot` (this will be an image file).
6. Repeat the command from step 2.
7. Result: segfault.

OBSERVED RESULT
Segfaults.

EXPECTED RESULT
While I understand that the `--edit-existing` option is treated as "standalone", meaning that the image file must exist beforehand *and* it (probably) shouldn't be used with other screenshot options, I think that spectacle should manage this situation better than segfaulting.

Request: spectacle should warn the user or fail gracefully if incompatible options are used.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.18.10-zen1-1-zen (64-bit)
Graphics Platform: Wayland


ADDITIONAL INFORMATION
Backtrace attached as backtrace.txt
Comment 1 postix 2022-07-13 18:11:52 UTC
Can confirm on openSUSE TW.
Comment 2 Bug Janitor Service 2022-10-03 09:18:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/153
Comment 3 Noah Davis 2023-11-22 13:50:33 UTC
Spectacle's behavior now opens the image in the annotation editor without being affected by the --region and --background CLI options if the file specified for --edit-existing exists. If it does not exist, it does a region capture, but doesn't seem to do it in the background. The segfault is fixed, which is what this report is about, but it doesn't do the smart behavior you wanted. On the other hand, you can directly annotate from the region selection overlay.