Skip to content

Commit

Permalink
Prevent segfault; final(?) commit in v2 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlcctrlv committed Mar 12, 2023
1 parent e42e1a2 commit cf4fc08
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#rustflags = ["-C", "link-arg=-fuse-ld=lld"]

[env]
MFEK_REL_CODENAME = "Metafontverse"
MFEK_REL_CODENAME = "Repetitive Spline Injury"
31 changes: 15 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "MFEKglif"
version = "1.1.1-beta2"
version = "2.0.0-beta1"
authors = ["Fredrick Brennan <[email protected]>", "Matthew Blanchard <[email protected]>", "MFEK Authors"]
edition = "2021"
license = "Apache-2.0"
Expand Down Expand Up @@ -88,20 +88,23 @@ ctrlc = "3.2"

## Our crates
# parses .glif files and gives us a place to put arbitrary data
#glifparser = { git = "https://github.com/MFEK/glifparser.rlib", branch = "master", features=["skia", "mfek"] }
glifparser = { path = "../glifparser.rlib", features=["skia", "mfek"] } # for development
glifparser = { git = "https://github.com/MFEK/glifparser.rlib", branch = "master", features=["skia", "mfek"] }
#glifparser = { path = "../glifparser.rlib", features=["skia", "mfek"] } # for development

#MFEKmath = { git = "https://github.com/MFEK/math.rlib", branch = "main" }
MFEKmath = { path = "../math.rlib" } # for development
MFEKmath = { git = "https://github.com/MFEK/math.rlib", branch = "main" }
#MFEKmath = { path = "../math.rlib" } # for development

pub-mod = { git = "https://github.com/MFEK/pub_mod.rlib" }

#mfek-ipc = { git = "https://github.com/MFEK/ipc.rlib" }
mfek-ipc = { path = "../ipc.rlib" } # for development
mfek-ipc = { git = "https://github.com/MFEK/ipc.rlib" }
#mfek-ipc = { path = "../ipc.rlib" } # for development

#glifrenderer = { git = "https://github.com/MFEK/glifrenderer.rlib" }
glifrenderer = { path = "../glifrenderer.rlib" } # for development
glifrenderer = { git = "https://github.com/MFEK/glifrenderer.rlib" }
#glifrenderer = { path = "../glifrenderer.rlib" } # for development

# forked from linebender/spline
#spline = { path = "../spline.rlib" } # for development
spline = { git = "https://github.com/MFEK/spline.rlib" }

#xml parsing
xmltree = "0.10"
Expand All @@ -125,8 +128,7 @@ flo_curves = "0.6"
plist = "1.3"

# we use this for affine matrices in some of our data types
kurbo = {version = "0.9.0", features = ["serde"]}
spline = {git="https://github.com/linebender/spline"}
kurbo = { version = "0.9.0", features = ["serde"] }

# show backtrace
backtrace = "0.3"
Expand Down
7 changes: 4 additions & 3 deletions src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::user_interface::Interface;

use std::path::PathBuf;
use std::process;
use std::thread;

lazy_static::lazy_static! {
pub static ref METADATA_AVAILABLE: Result<(module::Version<'static>, PathBuf), ()> = mfek_ipc::module::available("metadata", "0.0.3-beta1");
Expand Down Expand Up @@ -155,15 +156,15 @@ pub fn fetch_metrics(v: &mut Editor) {
v.ipc_info = Some(ipc_info);
}

pub fn launch_fs_watcher(v: &mut Editor) {
pub fn launch_fs_watcher(v: &mut Editor) -> thread::JoinHandle<()> {
let filename = v.with_glyph(|glyph| glyph.filename.clone());
let ipc_info = IPCInfo::from_glif_path("MFEKglif".to_string(), &filename.as_ref().unwrap());
if let Some(font) = ipc_info.font {
mfek_ipc::notifythread::launch(font, v.filesystem_watch_tx.clone());
mfek_ipc::notifythread::launch(font, v.filesystem_watch_tx.clone())
} else {
mfek_ipc::notifythread::launch(
ipc_info.glyph.unwrap().parent().unwrap().to_owned(),
v.filesystem_watch_tx.clone(),
);
)
}
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn main() {

ctrlc::set_handler(util::quit_next_frame).expect("Could not set SIGTERM handler.");

ipc::launch_fs_watcher(&mut editor);
let _notify_thread = ipc::launch_fs_watcher(&mut editor);

command::initialize_keybinds();
// TODO: Replace console! tools::console::initialize_console_commands();
Expand Down
5 changes: 4 additions & 1 deletion src/user_interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub struct Interface {
prompts: Vec<InputPrompt>,
sdl_context: Sdl,
sdl_dpi: f32,
pub sdl_window: Window,

pub context: Option<(f32, f32)>,
pub grid: Grid,
Expand All @@ -49,6 +48,10 @@ pub struct Interface {
pub gl_ctx: GLContext,
pub gr_context: RCHandle<GrDirectContext>,
pub fb_info: FramebufferInfo,

// Window *must* be dropped at end to prevent a segmentation fault.
// See <https://github.com/rust-skia/rust-skia/issues/476>.
pub sdl_window: Window,
}

impl Interface {
Expand Down

0 comments on commit cf4fc08

Please sign in to comment.