Skip to content

Commit aad4a68

Browse files
authored
Fix incorrect memory layout on Rust >= 1.67.0 (#28)
1 parent 1f648e9 commit aad4a68

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ cef_cache/
1313
hs_err_pid*.log
1414

1515
# Do not commit CEF binaries
16-
/java-cef/org.eclipse.set.browser.cef/cef
16+
/java/org.eclipse.set.browser.cef.win32/cef
1717
/cef

native/chromium/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ fn gen_cef(cef_path: std::path::Display) {
110110
dst.write(new_data.as_bytes()).expect("Cannot write mod.rs");
111111
}
112112

113+
#[repr(C)]
113114
#[derive(Debug)]
114115
struct ToJavaCallbacks();
115116

native/chromium_subp/src/app/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use std::ffi::{CStr, CString};
1717
use std::mem;
1818
use std::os::raw::c_int;
1919

20+
#[repr(C)]
2021
pub struct Base {}
2122

2223
impl Base {
@@ -31,6 +32,7 @@ impl Base {
3132
}
3233
}
3334

35+
#[repr(C)]
3436
pub struct App {
3537
cef: chromium::cef::_cef_app_t,
3638
render_process_handler: RenderProcessHandler,
@@ -76,10 +78,12 @@ impl App {
7678
}
7779
}
7880

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

86+
#[repr(C)]
8387
struct RenderProcessHandler {
8488
cef: chromium::cef::_cef_render_process_handler_t,
8589
function_handler: Option<V8Handler>,
@@ -307,6 +311,7 @@ unsafe fn convert_type(
307311
}
308312
}
309313

314+
#[repr(C)]
310315
struct V8Handler {
311316
cef: chromium::cef::_cef_v8handler_t,
312317
browser: *mut chromium::cef::_cef_browser_t,

native/chromium_subp/src/socket.rs

+2
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ impl ReturnType {
4040
}
4141
}
4242

43+
#[repr(C)]
4344
#[derive(Debug, PartialEq, Eq)]
4445
pub struct ReturnSt {
4546
pub kind: ReturnType,
4647
pub str_value: CString,
4748
}
4849

50+
#[repr(C)]
4951
#[derive(Debug, PartialEq, Eq)]
5052
struct ReturnMsg {
5153
kind: ReturnType,

0 commit comments

Comments
 (0)