Skip to content

Fix incorrect memory layout on Rust >= 1.67.0 #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ cef_cache/
hs_err_pid*.log

# Do not commit CEF binaries
/java-cef/org.eclipse.set.browser.cef/cef
/java/org.eclipse.set.browser.cef.win32/cef
/cef
1 change: 1 addition & 0 deletions native/chromium/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ fn gen_cef(cef_path: std::path::Display) {
dst.write(new_data.as_bytes()).expect("Cannot write mod.rs");
}

#[repr(C)]
#[derive(Debug)]
struct ToJavaCallbacks();

Expand Down
5 changes: 5 additions & 0 deletions native/chromium_subp/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::ffi::{CStr, CString};
use std::mem;
use std::os::raw::c_int;

#[repr(C)]
pub struct Base {}

impl Base {
Expand All @@ -31,6 +32,7 @@ impl Base {
}
}

#[repr(C)]
pub struct App {
cef: chromium::cef::_cef_app_t,
render_process_handler: RenderProcessHandler,
Expand Down Expand Up @@ -76,10 +78,12 @@ impl App {
}
}

#[repr(C)]
#[derive(Clone, Copy)]
struct Browser(*mut chromium::cef::_cef_browser_t);
unsafe impl Send for Browser {}

#[repr(C)]
struct RenderProcessHandler {
cef: chromium::cef::_cef_render_process_handler_t,
function_handler: Option<V8Handler>,
Expand Down Expand Up @@ -307,6 +311,7 @@ unsafe fn convert_type(
}
}

#[repr(C)]
struct V8Handler {
cef: chromium::cef::_cef_v8handler_t,
browser: *mut chromium::cef::_cef_browser_t,
Expand Down
2 changes: 2 additions & 0 deletions native/chromium_subp/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ impl ReturnType {
}
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq)]
pub struct ReturnSt {
pub kind: ReturnType,
pub str_value: CString,
}

#[repr(C)]
#[derive(Debug, PartialEq, Eq)]
struct ReturnMsg {
kind: ReturnType,
Expand Down