Skip to content
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

V panic on gg.Context.remove_cached_image_by_idx #23584

Open
islonely opened this issue Jan 26, 2025 · 1 comment
Open

V panic on gg.Context.remove_cached_image_by_idx #23584

islonely opened this issue Jan 26, 2025 · 1 comment

Comments

@islonely
Copy link
Contributor

islonely commented Jan 26, 2025

V version: V 0.4.9 4e68a86, press to see full `v doctor` output
V full version V 0.4.9 4b6b852.4e68a86
OS windows, Microsoft Windows 11 Pro 22631 64-bit
Processor 16 cpus, 64bit, little endian, Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
Memory 16.57GB/31.87GB
V executable C:\Users\imado\v\v.exe
V last modified time 2025-01-22 05:15:49
V home dir OK, value: C:\Users\imado\v
VMODULES OK, value: C:\Users\imado.vmodules
VTMP OK, value: C:\Users\imado\AppData\Local\Temp\v_0
Current working dir OK, value: C:\Users\imado\Documents\GitHub\bibleclock
Git version git version 2.33.1.windows.1
V git status weekly.2025.03-22-g4e68a860 (17 commit(s) behind V master)
.git/config present true
cc version N/A
gcc version gcc (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 12.2.0
clang version (built by Brecht Sanders) clang version 15.0.7
msvc version N/A
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status thirdparty-windows-amd64 b425ac82
emcc version N/A
glibc version ldd (cygwin) 3.3.6

What did you do?
./v -g -o vdbg cmd/v && ./vdbg C:\Users\imado\Documents\test.v && C:\Users\imado\Documents\test.exe

import gg

@[heap]
struct App {
	gg.Context
mut:
	prev gg.Image
	curr gg.Image
}

fn main() {
	mut app := &App{}
	app.Context = gg.new_context(
		user_data: app
		frame_fn:  frame
		init_fn:   init
	)
	app.run()
}

fn init(mut app App) {
	app.prev = app.create_image(@VEXEROOT + r'/vlib/v/embed_file/tests/v.png') or {
		eprintln(err)
		exit(1)
	}
	app.curr = app.create_image(@VEXEROOT + r'/vlib/v/embed_file/tests/v.png') or {
		eprintln(err)
		exit(1)
	}
	app.remove_cached_image_by_idx(app.prev.id)
	app.remove_cached_image_by_idx(app.curr.id)
}

fn frame(mut app App) {
	println('success')
	exit(0)
}

What did you see?

V panic: array.delete: index out of range (i,a.len):1, 1
v hash: 4e68a86
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:6810: at _v_panic: Backtrace
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:6841: by panic_n2
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:6169: by array_delete_many
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:6161: by array_delete
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:11586: by gg__Context_remove_cached_image_by_idx
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:11747: by main__init
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:11211: by gg__gg_init_sokol_window
C:/Users/imado/v/thirdparty/sokol/sokol_app.h:3046: by _sapp_call_init
C:/Users/imado/v/thirdparty/sokol/sokol_app.h:3278: by _sapp_frame
C:/Users/imado/v/thirdparty/sokol/sokol_app.h:8142: by _sapp_win32_run
C:/Users/imado/v/thirdparty/sokol/sokol_app.h:11653: by sapp_run
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:11065: by sokol__sapp__run
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:11478: by gg__Context_run
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:11723: by main__main
C:/Users/imado/AppData/Local/Temp/v_0/test.01JJG4CJJQA67WQ7V071BZNX23.tmp.c:11806: by wWinMain
0051bb1f : by ???
0051bc80 : by ???
7fffd9f8259d : by ???

What did you expect to see?

Expected code to compile and run, remove cached images, and exit successfully.

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Copy link

Connected to Huly®: V_0.6-22010

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

No branches or pull requests

1 participant