Skip to content

Crash on Global search when a file name is a prefix of a folder which is a parent of a matched file #1662

@jeremypw

Description

@jeremypw

What Happened?

A directory containing the following structure was opened as a project:

aaaa.test (folder)
      |
       -> test (file containing target string - FOO)
aaaa (empty file)

On performing a global search in this project for "FOO" Code crashed with the error invalid cast from 'ScratchFolderManagerFileItem' to 'ScratchFolderManagerFolderItem'

Steps to Reproduce

See above

Expected Behavior

It does not crash

OS Version

8.x (Circe)

OS Architecture

amd64 (on most hardwares)

Session Type

Secure Session (Wayland)

Software Version

Latest release (I have run all updates)

Log Output

(io.elementary.code:6270): GLib-GObject-CRITICAL **: 16:57:06.126: invalid cast from 'ScratchFolderManagerFileItem' to 'ScratchFolderManagerFolderItem'

Thread 1 "io.elementary.c" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff7ec36b1 in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) backtrace
#0  0x00007ffff7ec36b1 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007ffff7ec3963 in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff7c6b08e in g_type_check_instance_cast () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3  0x00005555555ade7f in scratch_folder_manager_file_view_find_path
    (self=0x555555d6f970, list=0x55555654fbf0, path=0x555555dddf90 "/home/jeremy/TestFolder/demo-prefix-crash/backend/aaaa.test/backend.test", expand=1) at ../src/FolderManager/FileView.vala:235
#4  0x00005555555adf45 in scratch_folder_manager_file_view_find_path
    (self=0x555555d6f970, list=0x5555560aae10, path=0x555555dddf90 "/home/jeremy/TestFolder/demo-prefix-crash/backend/aaaa.test/backend.test", expand=1) at ../src/FolderManager/FileView.vala:242
#5  0x00005555555adf45 in scratch_folder_manager_file_view_find_path
    (self=0x555555d6f970, list=0x555555d56550, path=0x555555dddf90 "/home/jeremy/TestFolder/demo-prefix-crash/backend/aaaa.test/backend.test", expand=1) at ../src/FolderManager/FileView.vala:242
#6  0x00005555555ae453 in scratch_folder_manager_file_view_expand_to_path (self=0x555555d6f970, path=0x555555dddf90 "/home/jeremy/TestFolder/demo-prefix-crash/backend/aaaa.test/backend.test")
    at ../src/FolderManager/FileView.vala:267
#7  0x000055555558bec9 in scratch_main_window_restore_opened_documents_co (_data_=0x5555557d1040) at ../src/MainWindow.vala:704
#8  0x000055555558b300 in scratch_main_window_restore_opened_documents_ready (source_object=0x5555557b4b70, _res_=0x5555564bec90, _user_data_=0x5555557d1040) at ../src/MainWindow.vala:689
#9  0x00007ffff7d4279b in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#10 0x00007ffff7d466f3 in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#11 0x000055555558d10e in scratch_main_window_open_document_co (_data_=0x5555564bce60) at ../src/MainWindow.vala:786
#12 0x000055555558cf40 in scratch_main_window_open_document_ready (source_object=0x555555ce8450, _res_=0x5555564be0a0, _user_data_=0x5555564bce60) at ../src/MainWindow.vala:792
#13 0x00007ffff7d4279b in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#14 0x00007ffff7d466f3 in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#15 0x00005555555f6391 in scratch_widgets_document_view_open_document_co (_data_=0x555555eb13a0) at ../src/Widgets/DocumentView.vala:324
#16 0x00005555555f5b41 in scratch_widgets_document_view_open_document_ready (source_object=0x5555563de450, _res_=0x5555564eb130, _user_data_=0x555555eb13a0) at ../src/Widgets/DocumentView.vala:355
#17 0x00007ffff7d4279b in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#18 0x00007ffff7d466f3 in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#19 0x00005555555cc410 in scratch_services_document_open_co (_data_=0x5555563e9d90) at ../src/Services/Document.vala:473
#20 0x00005555555caab2 in scratch_services_document_open_ready (source_object=0x555555ded350, _res_=0x5555565511a0, _user_data_=0x5555563e9d90) at ../src/Services/Document.vala:430
#21 0x00007ffff7d4279b in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#22 0x00007ffff7d466f3 in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#23 0x00007ffff70628e7 in ??? () at /lib/x86_64-linux-gnu/libgtksourceview-4.so.0
#24 0x00007ffff7d0fc2e in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#25 0x00007ffff7d4279b in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#26 0x00007ffff7d427d5 in ??? () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#27 0x00007ffff7ebe49e in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007ffff7f1d737 in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007ffff7ebda63 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007ffff7d7887d in g_application_run () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#31 0x0000555555585948 in scratch_application_main (args=0x7fffffffd9d8, args_length1=1) at ../src/Application.vala:226

Hardware Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions