1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: stricter mutable reference check (fix #14803) (#14805)

This commit is contained in:
yuyi
2022-06-21 18:23:21 +08:00
committed by GitHub
parent c6f94e9cab
commit c160ba2a8d
11 changed files with 51 additions and 21 deletions

View File

@ -86,7 +86,7 @@ pub fn init(cfg Config) &Context {
C.atexit(restore_terminal_state)
for code in ctx.cfg.reset {
os.signal_opt(code, fn (_ os.Signal) {
mut c := ui.ctx_ptr
mut c := unsafe { ui.ctx_ptr }
if unsafe { c != 0 } {
c.cleanup()
}

View File

@ -43,7 +43,7 @@ fn restore_terminal_state_signal(_ os.Signal) {
fn restore_terminal_state() {
termios_reset()
mut c := ctx_ptr
mut c := unsafe { ctx_ptr }
if unsafe { c != 0 } {
c.paused = true
load_title()
@ -125,7 +125,7 @@ fn (mut ctx Context) termios_setup() ? {
C.atexit(restore_terminal_state)
os.signal_opt(.tstp, restore_terminal_state_signal) or {}
os.signal_opt(.cont, fn (_ os.Signal) {
mut c := ctx_ptr
mut c := unsafe { ctx_ptr }
if unsafe { c != 0 } {
c.termios_setup() or { panic(err) }
c.window_height, c.window_width = get_terminal_size()
@ -140,7 +140,7 @@ fn (mut ctx Context) termios_setup() ? {
}) or {}
for code in ctx.cfg.reset {
os.signal_opt(code, fn (_ os.Signal) {
mut c := ctx_ptr
mut c := unsafe { ctx_ptr }
if unsafe { c != 0 } {
c.cleanup()
}
@ -149,7 +149,7 @@ fn (mut ctx Context) termios_setup() ? {
}
os.signal_opt(.winch, fn (_ os.Signal) {
mut c := ctx_ptr
mut c := unsafe { ctx_ptr }
if unsafe { c != 0 } {
c.window_height, c.window_width = get_terminal_size()