Fix a panic with dolphin-emu-nogui

That app pops up a window which has neither app_id nor name which I assumed all
windows have.  Now check for pid and shell to determine a con't type as window.
timeout_old
Tassilo Horn 3 years ago
parent 8979df958a
commit 90c0d46f04
  1. 4
      Cargo.lock
  2. 11
      src/tree.rs

4
Cargo.lock generated

@ -150,9 +150,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.107" version = "0.2.108"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
[[package]] [[package]]
name = "memchr" name = "memchr"

@ -93,19 +93,24 @@ impl NodeMethods for s::Node {
if self.node_type == s::NodeType::Con if self.node_type == s::NodeType::Con
&& self.name.is_none() && self.name.is_none()
&& self.app_id.is_none() && self.app_id.is_none()
&& self.pid.is_none()
&& self.shell.is_none()
&& self.window_properties.is_none() && self.window_properties.is_none()
&& self.layout != s::NodeLayout::None && self.layout != s::NodeLayout::None
{ {
Type::Container Type::Container
} else if (self.node_type == s::NodeType::Con } else if (self.node_type == s::NodeType::Con
|| self.node_type == s::NodeType::FloatingCon) || self.node_type == s::NodeType::FloatingCon)
&& self.name.is_some() // Apparently there can be windows without app_id, name,
// and window_properties.class, e.g., dolphin-emu-nogui.
&& self.pid.is_some()
&& self.shell.is_some()
{ {
Type::Window Type::Window
} else { } else {
panic!( panic!(
"Don't know type of node with id {} and node_type {:?}", "Don't know type of node with id {} and node_type {:?}\n{:?}",
self.id, self.node_type self.id, self.node_type, self
) )
} }
} }

Loading…
Cancel
Save