Skip to content

fix: remove the library retain logic - #213

Merged
dsh0416 merged 1 commit into
mainfrom
dsh0416/retrain-library
Jun 8, 2026
Merged

fix: remove the library retain logic#213
dsh0416 merged 1 commit into
mainfrom
dsh0416/retrain-library

Conversation

@dsh0416

@dsh0416 dsh0416 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

fixes #212

Copilot AI review requested due to automatic review settings June 7, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the global CEF lifecycle management in gdcef to avoid attempting a shutdown/reinitialize cycle within the same process, addressing the macOS crash reported in #212 when destroying the last CefTexture and creating a new one later.

Changes:

  • Make CEF initialization effectively “one-time per process” by keying init on an initialized flag rather than ref_count == 0.
  • Remove the “shutdown on last release” behavior so later cef_retain() calls don’t need to reload/reinitialize CEF.
  • Add a unit test asserting that releasing the last reference keeps CEF marked initialized.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 78 to 81
pub fn cef_release() {
let mut state = lock_cef_state();

if state.ref_count == 0 {
return;
}

state.ref_count -= 1;

if state.ref_count == 0 && state.initialized {
cef::shutdown();
state.initialized = false;
}
state.release();
}
@dsh0416
dsh0416 merged commit ed67a91 into main Jun 8, 2026
40 of 43 checks passed
@dsh0416
dsh0416 deleted the dsh0416/retrain-library branch June 8, 2026 16:41
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.

[Bug]: Failed to load macOS CEF framework

2 participants