Skip to content

search provider: Don't try to process if ID is invalid#202

Merged
FineFindus merged 1 commit into
FineFindus:mainfrom
City-busz:search-provider-fix
Jul 29, 2025
Merged

search provider: Don't try to process if ID is invalid#202
FineFindus merged 1 commit into
FineFindus:mainfrom
City-busz:search-provider-fix

Conversation

@City-busz

Copy link
Copy Markdown
Contributor

It causes a panic if invalid ID is sent via D-Bus.

$ gdbus call -e -d com.github.finefindus.eyedropper.SearchProvider -o /com/github/finefindus/eyedropper/SearchProvider -m org.gnome.Shell.SearchProvider2.GetResultMetas '["invalid"]'
$ gdbus call -e -d com.github.finefindus.eyedropper.SearchProvider -o /com/github/finefindus/eyedropper/SearchProvider -m org.gnome.Shell.SearchProvider2.ActivateResult "invalid" "[]" 0

Which causes the following panic:

thread 'main' panicked at src/application.rs:266:58:
Failed to parse identifier color: BoolError { message: "Can't parse RGBA", filename: "/usr/src/debug/eyedropper/build/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/gdk4-0.9.6/src/rgba.rs", function: "gdk4::rgba::<impl gdk4::auto::rgba::RGBA>::parse::{{closure}}", line: 207 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'zbus::Connection executor' panicked at /usr/src/debug/eyedropper/build/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/search-provider-0.11.0/src/search_provider.rs:157:39:
called `Result::unwrap()` on an `Err` value: Canceled
thread 'main' panicked at src/application.rs:247:55:
called `Result::unwrap()` on an `Err` value: BoolError { message: "Can't parse RGBA", filename: "/usr/src/debug/eyedropper/build/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/gdk4-0.9.6/src/rgba.rs", function: "gdk4::rgba::<impl gdk4::auto::rgba::RGBA>::parse::{{closure}}", line: 207 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This change fixes that.

@FineFindus FineFindus left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too happy with this, as it's handling an invariant, that is already guaranteed by the D-Bus interface.

Comment thread src/application.rs Outdated
It causes a panic if invalid ID is sent via D-Bus.
@City-busz City-busz force-pushed the search-provider-fix branch from 71dfc00 to beee19c Compare July 28, 2025 21:36
@FineFindus FineFindus merged commit 913d7f7 into FineFindus:main Jul 29, 2025
3 of 4 checks passed
@FineFindus

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants