etorth / libnvc

Easy way to embed (neo)vim in your application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nvim_sdl2 crash

nagolove opened this issue · comments

[testuser@legion nvim_sdl2]$ ./nvim_sdl2
INFO: : req_id = req::nvim_ui_attach, seq_id = 2
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
Aborted (core dumped)
[testuser@legion nvim_sdl2]$ gdb ./nvim_sdl2
Reading symbols from ./nvim_sdl2...
(gdb) r
Starting program: /home/testuser/b_nvim_sdl2/install/nvim_sdl2/nvim_sdl2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after fork from child process 2468]
[New Thread 0x7ffff7253700 (LWP 2469)]
[New Thread 0x7fffe9124700 (LWP 2470)]
[New Thread 0x7fffe3fff700 (LWP 2471)]
[New Thread 0x7fffe8923700 (LWP 2472)]
[New Thread 0x7fffe37fe700 (LWP 2473)]
[New Thread 0x7ffff41ab700 (LWP 2474)]
INFO: : req_id = req::nvim_ui_attach, seq_id = 2
DEBUG: Ignored notif: hl_group_set
<<some output removed>>
INFO:
DEBUG: Ignored notif: busy_stop
terminate called after throwing an instance of 'std::runtime_error'
  what():  In file: nvimclient.cpp:53, function: size_t peek_utf8_code(const char*, size_t, uint32_t*): Invalid argument: empty string

Thread 1 "nvim_sdl2" received signal SIGABRT, Aborted.
0x00007ffff78fcce5 in raise () from /usr/lib/libc.so.6
(gdb) info stack
#0  0x00007ffff78fcce5 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff78e6857 in abort () from /usr/lib/libc.so.6
#2  0x00007ffff7c7f81d in __gnu_cxx::__verbose_terminate_handler ()
    at /build/gcc/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff7c8c2ca in __cxxabiv1::__terminate (handler=<optimized out>)
    at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#4  0x00007ffff7c8c337 in std::terminate () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#5  0x00007ffff7c8c59e in __cxxabiv1::__cxa_throw (obj=<optimized out>,
    tinfo=0x55555574b920 <typeinfo for std::runtime_error@@GLIBCXX_3.4>,
    dest=0x7ffff7ca27f0 <std::runtime_error::~runtime_error()>)
    at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:95
#6  0x00005555556d723e in peek_utf8_code(char const*, unsigned long, unsigned int*) ()
#7  0x00005555556d82e4 in libnvc::nvim_client::set_cell(unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long, int) ()
#8  0x00005555556d8bc6 in libnvc::nvim_client::on_grid_line(long, long, long, std::vector<std::variant<bool, long, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<libnvc::object_wrapper, std::allocator<libnvc::object_wrapper> >, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, libnvc::object_wrapper, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libnvc::object_wrapper> > > >, std::allocator<std::variant<bool, long, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<libnvc::object_wrapper, std::allocator<libnvc::object_wrapper> >, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, libnvc::object_wrapper, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libnvc::object_wrapper> > > > > > const&) ()
#9  0x00005555556bbb59 in inn_dispatch_notif(char const*, mpack_node_t, libnvc::api_client*) ()
#10 0x00005555556c2b7b in libnvc::api_client::poll_one() ()
#11 0x0000555555694b2e in libnvc::api_client::poll (this=0x55555603a5a0)
    at /home/testuser/b_libnvc/install/include/libnvc.hpp:3653
#12 0x0000555555695740 in nvim_sdlwidget::update (this=0x7fffffffe290)
    at /home/testuser/libnvc/sample/nvim_sdl2/src/sdlwidget.hpp:70
#13 0x0000555555694345 in main () at /home/testuser/libnvc/sample/nvim_sdl2/src/main.cpp:154

Hi what's the nvim version you are using?

I use default nvim from Manjaro repository.

nvim --version
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.3/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

sorry I can't reproduce.
This looks like the protocol libnvc and nvim using are not compatible.

Can you please try 1) clone the latest nvim and latest libnvc and try?
2) download the nvim 0.4.3 appimage: https://github.com/neovim/neovim/releases/download/v0.4.3/nvim.appimage

then do: env LIBNVC_NVIM_BINARY=path/to/nvim.appimage ./nvim_sdl2

try this see what you get?

the environmental variable: LIBNVC_NVIM_BINARY
is prettry handy when I trying to debug libnvc with different version of nvim.