@amymor @Alan-Kilborn
I suppose that I have found the cause of the problem
It looks like calling NPPM_GETLANGUAGENAME with a value of -1 can cause npp to crash. I assume this also applies to NPPM_GETLANGUAGEDESC, as I suspect the problem manifests itself when getLangDesc is called.
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff6413bc493 in notepad++!GetNameSpace ()
(gdb) bt
#0 0x00007ff6413bc493 in notepad++!GetNameSpace ()
#1 0x00007ff6413d8f2d in notepad++!GetNameSpace ()
#2 0x00007ff6413dab12 in notepad++!GetNameSpace ()
#3 0x00007ff6413d4ce1 in notepad++!GetNameSpace ()
#4 0x00007ffd14c0e858 in USER32!CallWindowProcW () from C:\WINDOWS\System32\user32.dll
#5 0x00007ffd14c0e3dc in USER32!DispatchMessageW () from C:\WINDOWS\System32\user32.dll
#6 0x00007ffd14c20bc3 in USER32!SendMessageTimeoutW () from C:\WINDOWS\System32\user32.dll
#7 0x00007ffd16ed0d74 in ntdll!KiUserCallbackDispatcher () from C:\WINDOWS\SYSTEM32\ntdll.dll
#8 0x00007ffd14251124 in win32u!NtUserMessageCall () from C:\WINDOWS\System32\win32u.dll
#9 0x00007ffd14c0df02 in USER32!SendMessageW () from C:\WINDOWS\System32\user32.dll
#10 0x00007ffd14c0d68a in USER32!SendMessageW () from C:\WINDOWS\System32\user32.dll
#11 0x00007ffce3751888 in notepadpp__Npp_call (n=..., msg=2107, wparam=18446744073709551615, lparam=0)
I add a check in EnhanceAnyLexer to prevent calling it in this case
pub fn(n Npp) get_language_name(buffer_id usize) string {
lang_type := n.call(nppm_getbufferlangtype, buffer_id, isize(0))
if lang_type == -1 {
return 'UNKNOWN_ERROR'
}
mut buffer_size := int(n.call(nppm_getlanguagename, usize(lang_type), isize(0))) + 1
mut buffer := alloc_wide(buffer_size)
n.call(nppm_getlanguagename, usize(lang_type), isize(buffer))
lang_name := unsafe { string_from_wide(buffer) }
return lang_name.to_lower().replace('udf - ', '')
}
An issue has been opened.