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

code spelling checker causes install crash #364

Open
gedw99 opened this issue Dec 9, 2024 · 6 comments
Open

code spelling checker causes install crash #364

gedw99 opened this issue Dec 9, 2024 · 6 comments
Labels
bug Something isn't working correctly confirmed This bug has been confirmed

Comments

@gedw99
Copy link

gedw99 commented Dec 9, 2024

Describe the bug

Both Mac and web fail

just compile cogent code and then run it.

when you click "spell" in the top menu, it crashes.

How to reproduce

Both Mac and web fail

just compile cogent code and then run it.

when you click "spell" in the top menu, it crashes.

Example code

No response

Relevant output

web

 

Cogent Code stopped unexpectedly

There was an unexpected error and Cogent Code stopped running.

Crash log saved in /home/me/.data/Cogent\ Code/crash-logs

Platform: Web
System platform: MacOS
App version: v0.1.0-239-g89fd5f1
Core version: v0.3.6-0.20241105213322-d6528a66fa54
Time: 2024-12-09 17:41:03
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1.1 Safari/605.1.15

panic: runtime error: invalid memory address or nil pointer dereference

goroutine 157 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:26 +0x6
cogentcore.org/core/core.handleRecover({0x16e0a0, 0x1be08b0})
cogentcore.org/[email protected]/core/recover.go:42 +0x5
cogentcore.org/core/core.(*renderWindow).eventLoop.func1()
cogentcore.org/[email protected]/core/renderwindow.go:376 +0x5
panic({0x16e0a0, 0x1be08b0})
runtime/panic.go:785 +0x1a
cogentcore.org/core/spell.(*SpellData).OpenUserCheck(0x0)
cogentcore.org/[email protected]/spell/spell.go:89 +0x2
cogentcore.org/cogent/code.(*Code).Spell(0x30fd108)
cogentcore.org/cogent/code/views.go:105 +0xd
reflect.Value.call({0xf6760, 0x3af59b0, 0x13}, {0x2d16ff, 0x4}, {0x0, 0x0, 0x0})
reflect/value.go:581 +0x147
reflect.Value.Call({0xf6760, 0x3af59b0, 0x13}, {0x0, 0x0, 0x0})
reflect/value.go:365 +0xd
cogentcore.org/core/core.(*FuncButton).callFuncShowReturns(0x3afc408)
cogentcore.org/[email protected]/core/funcbutton.go:302 +0x9
cogentcore.org/core/core.(*FuncButton).CallFunc(0x3afc408)
cogentcore.org/[email protected]/core/funcbutton.go:337 +0x17
cogentcore.org/core/core.(*FuncButton).Init.func2({0x814fc8, 0x3aeafc0})
cogentcore.org/[email protected]/core/funcbutton.go:157 +0xa
cogentcore.org/core/events.(*Listeners).Call(0x30bda10, {0x814fc8, 0x3aeafc0}, {0x3033a00, 0x1, 0x1})
cogentcore.org/[email protected]/events/listeners.go:61 +0x17
cogentcore.org/core/core.(*WidgetBase).HandleEvent.func1(0x3ae1080)
cogentcore.org/[email protected]/core/widgetevents.go:244 +0x2
cogentcore.org/core/base/tiered.(*Tiered[...]).Do(0x800cc0, 0x3033a98)
cogentcore.org/[email protected]/base/tiered/tiered.go:30 +0x7
cogentcore.org/core/core.(*WidgetBase).HandleEvent(0x3afc408, {0x814fc8, 0x3aeafc0})
cogentcore.org/[email protected]/core/widgetevents.go:243 +0x14
cogentcore.org/core/core.(*WidgetBase).Send(0x3afc408, 0x5, {0x30bddd0, 0x1, 0x1})
cogentcore.org/[email protected]/core/widgetevents.go:180 +0xe
cogentcore.org/core/core.(*Events).handlePosEvent(0x30fb360, {0x815248, 0x3ae9a40})
cogentcore.org/[email protected]/core/events.go:477 +0x1f1
cogentcore.org/core/core.(*Events).handleEvent(0x30fb360, {0x815248, 0x3ae9a40})
cogentcore.org/[email protected]/core/events.go:169 +0x8
cogentcore.org/core/core.(*Stage).mainHandleEvent(0x33e6e70, {0x815248, 0x3ae9a40})
cogentcore.org/[email protected]/core/mainstage.go:401 +0x2a
cogentcore.org/core/core.(*stages).mainHandleEvent(0x30714d0, {0x815248, 0x3ae9a40})
cogentcore.org/[email protected]/core/mainstage.go:409 +0x10
cogentcore.org/core/core.(*renderWindow).handleEvent(0x30714a0, {0x815248, 0x3ae9a40})
cogentcore.org/[email protected]/core/renderwindow.go:427 +0x25
cogentcore.org/core/core.(*renderWindow).eventLoop(0x30714a0)
cogentcore.org/[email protected]/core/renderwindow.go:390 +0x10
created by cogentcore.org/core/core.(*renderWindow).goStartEventLoop in goroutine 1
cogentcore.org/[email protected]/core/renderwindow.go:361 +0x6



---


Mac
```sh

Crash log saved in /Users/apple/Library/Cogent\ Code/crash-logs

Platform: MacOS
System platform: MacOS
App version: v0.1.0-239-g89fd5f1
Core version: v0.3.6-0.20241105213322-d6528a66fa54
Time: 2024-12-09 17:44:24

panic: runtime error: invalid memory address or nil pointer dereference

goroutine 11 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x64
cogentcore.org/core/core.handleRecover({0x106206960, 0x106beb810})
	cogentcore.org/[email protected]/core/recover.go:42 +0x60
cogentcore.org/core/core.(*renderWindow).eventLoop.func1()
	cogentcore.org/[email protected]/core/renderwindow.go:376 +0x34
panic({0x106206960?, 0x106beb810?})
	runtime/panic.go:785 +0x124
cogentcore.org/core/spell.(*SpellData).OpenUserCheck(0x0?)
	cogentcore.org/[email protected]/spell/spell.go:89 +0x28
cogentcore.org/cogent/code.(*Code).Spell(0x140001d8888)
	cogentcore.org/cogent/code/views.go:105 +0x44
reflect.Value.call({0x106188720?, 0x140004aefd0?, 0x0?}, {0x105a14a02, 0x4}, {0x0, 0x0, 0x10631bda0?})
	reflect/value.go:581 +0x97c
reflect.Value.Call({0x106188720?, 0x140004aefd0?, 0x5?}, {0x0?, 0x675691c8?, 0x83610e8?})
	reflect/value.go:365 +0x94
cogentcore.org/core/core.(*FuncButton).callFuncShowReturns(0x1400059fc08)
	cogentcore.org/[email protected]/core/funcbutton.go:302 +0xa0
cogentcore.org/core/core.(*FuncButton).CallFunc(0x1400059fc08)
	cogentcore.org/[email protected]/core/funcbutton.go:337 +0x280
cogentcore.org/core/core.(*FuncButton).Init.func2({0x10620ee80?, 0x140002b4ed0?})
	cogentcore.org/[email protected]/core/funcbutton.go:157 +0x38
cogentcore.org/core/events.(*Listeners).Call(0x140005a7a88, {0x1063a1fe8, 0x140108a2c40}, {0x140005a7a70, 0x1, 0x2?})
	cogentcore.org/[email protected]/events/listeners.go:61 +0x104
cogentcore.org/core/core.(*WidgetBase).HandleEvent.func1(0x140002b4ed0)
	cogentcore.org/[email protected]/core/widgetevents.go:244 +0x58
cogentcore.org/core/base/tiered.(*Tiered[...]).Do(0x7fca1c8, 0x140005a7b08?)
	cogentcore.org/[email protected]/base/tiered/tiered.go:30 +0x48
cogentcore.org/core/core.(*WidgetBase).HandleEvent(0x1400059fc08, {0x1063a1fe8?, 0x140108a2c40?})
	cogentcore.org/[email protected]/core/widgetevents.go:243 +0x11c
cogentcore.org/core/core.(*WidgetBase).Send(0x1400059fc08, 0x5, {0x140005a7d68?, 0x14000680008?, 0x140108a1960?})
	cogentcore.org/[email protected]/core/widgetevents.go:180 +0x80
cogentcore.org/core/core.(*Events).handlePosEvent(0x140001d7860, {0x1063a2268, 0x140109277a0})
	cogentcore.org/[email protected]/core/events.go:477 +0x1630
cogentcore.org/core/core.(*Events).handleEvent(0x140001d7860, {0x1063a2268, 0x140109277a0})
	cogentcore.org/[email protected]/core/events.go:169 +0x58
cogentcore.org/core/core.(*Stage).mainHandleEvent(0x140003f4dc0, {0x1063a2268, 0x140109277a0})
	cogentcore.org/[email protected]/core/mainstage.go:401 +0x170
cogentcore.org/core/core.(*stages).mainHandleEvent(0x1400024e5d0, {0x1063a2268, 0x140109277a0})
	cogentcore.org/[email protected]/core/mainstage.go:409 +0x78
cogentcore.org/core/core.(*renderWindow).handleEvent(0x1400024e5a0, {0x1063a2268, 0x140109277a0})
	cogentcore.org/[email protected]/core/renderwindow.go:427 +0x1c8
cogentcore.org/core/core.(*renderWindow).eventLoop(0x1400024e5a0)
	cogentcore.org/[email protected]/core/renderwindow.go:390 +0x90
created by cogentcore.org/core/core.(*renderWindow).goStartEventLoop in goroutine 1
	cogentcore.org/[email protected]/core/renderwindow.go:361 +0x6c



### Platform

macOS
@gedw99 gedw99 added the bug Something isn't working correctly label Dec 9, 2024
@kkoreilly
Copy link
Member

Thank you for reporting this. I can reproduce this issue and we will work on fixing it soon.

@kkoreilly kkoreilly added the confirmed This bug has been confirmed label Dec 10, 2024
@kkoreilly kkoreilly added this to Bugs Dec 10, 2024
@github-project-automation github-project-automation bot moved this to Todo in Bugs Dec 10, 2024
@gedw99
Copy link
Author

gedw99 commented Dec 10, 2024

Ok . I was going to work on it and then realised that it of course needs a spelling repository of data to work against. Each OS offers one but then I was thinking that a custom service that is OS agnostic might be better.

I use pocketbase with cogent and was thinking about a simple sql system.

what do you think though ?

@kkoreilly
Copy link
Member

@gedw99 We have our own spelling data embedded into the app (see https://github.com/cogentcore/core/blob/6fac9e04d921b414dbb2a25f8e5f3259e3c5fa1b/spell/dict_en_us), so that isn't the issue; there is just some initialization timing issue with the spelling object. You are of course free to work on a fix, or we will do it once we have the time.

@gedw99
Copy link
Author

gedw99 commented Dec 13, 2024

Thanks @kkoreilly

Good now the architecture approach.

I will try to work on a fix and let you know here if I start work on it so we don’t double up .

Eventually this will need to be to be decoupled in some way as it’s not sustainable to just add languages to an embedded file ?

@kkoreilly
Copy link
Member

Yes, we will use a new approach in time for internationalization, likely involving an HTTP call to some collection of spelling dictionaries that can then be cached to the filesystem. The spelling dictionaries have a small enough file size now for that work. See also cogentcore/core#711 and cogentcore/core#698 for some older discussion of the spelling and internationalization approach. However, those spelling improvements are not directly related to this crash and can be done separately.

@gedw99
Copy link
Author

gedw99 commented Dec 13, 2024

Makes sense now .

Thanks @kkoreilly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly confirmed This bug has been confirmed
Projects
Status: Todo
Development

No branches or pull requests

2 participants