Skip to content

mousepad-window: fix a crash when doing a search

liushuyu requested to merge liushuyu/mousepad:master into master

If there is only one document, the search function will crash the program with output like this:

(gdb) c
Continuing.
mousepad-window.c:5210:16: runtime error: member access within misaligned address 0xaaaaaaaaaaaaaaaa for type 'struct GTypeClass', which requires 8 byte alignment
0xaaaaaaaaaaaaaaaa: note: pointer points here
<memory cannot be printed>

Thread 1 "mousepad" received signal SIGSEGV, Segmentation fault.
0x000055555566f396 in mousepad_window_search_bar_switch_page (window=0x629000066310) at mousepad-window.c:5210
5210      old_buffer = MOUSEPAD_IS_DOCUMENT (window->previous) ? window->previous->buffer : NULL;

Merge request reports