Skip to content

Enhance stability on Windows#5723

Merged
emilk merged 2 commits intoemilk:masterfrom
rustbasic:patch160
Mar 21, 2025
Merged

Enhance stability on Windows#5723
emilk merged 2 commits intoemilk:masterfrom
rustbasic:patch160

Conversation

@rustbasic
Copy link
Contributor

@rustbasic rustbasic commented Feb 17, 2025

Dear emilk,

Programs built with egui on Windows are terminating every hour on average.
When this commit is applied, it works fine for about 3 to 6 hours on average.

I've been testing it for over 6 months and have submitted multiple PRs since 6 months ago,
but they haven't applied it yet.

Thank you.

@github-actions
Copy link

Preview available at https://egui-pr-preview.github.io/pr/5723-patch160
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin
Copy link
Collaborator

Can you explain why this change makes a difference? And what was changed for which reason? I tried to understand it from the diff but I can't make sense of it.

@lucasmerlin lucasmerlin added native-windows Running on native Windows OS egui labels Feb 18, 2025
@rustbasic
Copy link
Contributor Author

Can you explain why this change makes a difference? And what was changed for which reason? I tried to understand it from the diff but I can't make sense of it.

In Windows, the run_ui_and_paint() function is called when it's EventResult::Wait.
Previously, the return value of the run_ui_and_paint() function was ignored.
This is a modification to apply the return value of the run_ui_and_paint() function.

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

The old code ignored the new EventResult from the call to run_ui_and_paint, so I think the new code makes sense. No idea why it is causing crashes though (and I'm not convinced it does, but I don't have a Windows machine 🤷)

}
EventResult::RepaintNow(window_id) => {
log::trace!("RepaintNow of {window_id:?}",);
self.windows_next_repaint_times.insert(window_id, now);
Copy link
Owner

Choose a reason for hiding this comment

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

please revert the change to now - it is only adding confusion for no apparent gain

Suggested change
self.windows_next_repaint_times.insert(window_id, now);
self.windows_next_repaint_times.insert(window_id, Instant::now());

@emilk emilk added eframe Relates to epi and eframe and removed egui labels Mar 21, 2025
@emilk emilk changed the title Enhance Windows Stability Enhance stability on Windows Mar 21, 2025
@emilk emilk merged commit 91f02f9 into emilk:master Mar 21, 2025
27 checks passed
darkwater pushed a commit to darkwater/egui that referenced this pull request Aug 24, 2025
Dear emilk,

Programs built with egui on Windows are terminating every hour on
average.
When this commit is applied, it works fine for about 3 to 6 hours on
average.

I've been testing it for over 6 months and have submitted multiple PRs
since 6 months ago,
but they haven't applied it yet.

Thank you.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eframe Relates to epi and eframe native-windows Running on native Windows OS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants