diff options
| author | srdusr <[email protected]> | 2025-02-17 21:12:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-02-17 21:12:00 +0200 |
| commit | f7c6e9c607742ed373752aadf5761e99ec3eb64a (patch) | |
| tree | 433e666d8082821ce70fd97a2851f261fed864b8 /crates/config/src/engine | |
| parent | 413daa7ba2ea0ebd1424c024fd0566423aaea3f8 (diff) | |
| download | srdwm-f7c6e9c607742ed373752aadf5761e99ec3eb64a.tar.gz srdwm-f7c6e9c607742ed373752aadf5761e99ec3eb64a.zip | |
Checkpoint: today's fixes before reconciling with the rust-rewrite worktree
Fixes a live-reproduced VT-switch busy loop (failed page_flip retried
with no backoff), shadow rendering bleeding onto occluding windows
unclipped, and a winit-backend buffer-age correctness bug that left
stale cross-window pixels on screen. Committing before merging in the
much larger uncommitted rust-rewrite worktree, which independently
touches several of the same files - this is the pre-merge baseline to
diff against, not a claim that these are the final versions of these
fixes.
Diffstat (limited to 'crates/config/src/engine')
| -rw-r--r-- | crates/config/src/engine/general.rs | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/crates/config/src/engine/general.rs b/crates/config/src/engine/general.rs index 98cfebe..a50890f 100644 --- a/crates/config/src/engine/general.rs +++ b/crates/config/src/engine/general.rs @@ -194,14 +194,40 @@ impl Engine { })?) } + /// `srd.load("keybindings")`/`"themes"`/`"rules"`/`"startup"`: each is + /// its own file, its own logical concern, and - deliberately, since + /// this function catches its own execution error rather than letting + /// `?` propagate one - its own failure domain. A `mlua::Error` from + /// one module used to unwind straight out through this function and + /// back into whatever was running `init.lua` itself, aborting every + /// statement after that `srd.load` call, including every *other* + /// `srd.load` - a typo in `rules.lua` silently took `startup.lua` + /// (autostart) down with it, and there was no way from the config + /// author's side to prevent that, short of never making a mistake. + /// Reproduced live in the worse but related case (the error was in + /// `init.lua` itself, above every `srd.load` call, which this + /// function alone can't isolate against): a session that started with + /// nothing but a bare cursor, zero autostart, zero keybindings, no + /// error visible anywhere except one `WARN` line in a multi-hundred- + /// megabyte log file. A module failing now still leaves the user + /// without whatever that module would have set up, logged clearly at + /// `error` level with the module name and the file path - but + /// everything *else* `init.lua` goes on to load still does. pub(super) fn fn_load(&self) -> Result<mlua::Function<'_>> { let state = self.state.clone(); Ok(self.lua.create_function(move |lua, module: String| { let dir = state.borrow().config_dir.clone(); let path = dir.join(format!("{module}.lua")); - let src = std::fs::read_to_string(&path) - .map_err(|e| mlua::Error::RuntimeError(format!("srd.load('{module}'): {e} ({})", path.display())))?; - lua.load(&src).set_name(path.to_string_lossy().as_ref()).exec()?; + let src = match std::fs::read_to_string(&path) { + Ok(src) => src, + Err(e) => { + log::error!("srd.load('{module}'): {e} ({}) - this module did not load, but the rest of init.lua still will", path.display()); + return Ok(()); + } + }; + if let Err(e) = lua.load(&src).set_name(path.to_string_lossy().as_ref()).exec() { + log::error!("srd.load('{module}'): {e} - this module did not finish loading, but the rest of init.lua still will"); + } Ok(()) })?) } |