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 crashes when both a folder and its parent are open as projects and a document present in both is opened #1494

Open
jeremypw opened this issue Dec 18, 2024 · 12 comments · May be fixed by #1500
Labels
Priority: Critical e.g. security implications or reproducible crashing

Comments

@jeremypw
Copy link
Collaborator

What Happened?

Code crashed when opening a document in a parent project when the child folder was also open as a project.

Steps to Reproduce

  1. Close all docs and projects
  2. Open a folder as a project
  3. Open the parent of that folder as a project
  4. Navigate in the sidebar to a document present in the child folder and click to open it.
  5. Code crashes

Expected Behavior

Code should not crash - the document should open.

OS Version

8.x (Circe)

Session Type

Secure Session (Wayland)

Software Version

Compiled from git

Log Output

No response

Hardware Info

No response

@kaixoo
Copy link

kaixoo commented Dec 23, 2024

This is critical :)

@jeremypw jeremypw added the Priority: Critical e.g. security implications or reproducible crashing label Dec 23, 2024
@jeremypw
Copy link
Collaborator Author

Ideally should be confirmed by someone other than reporter before assigning priority ....

@kaixoo
Copy link

kaixoo commented Dec 23, 2024

I cannot reproduce...Can you still reproduce in your machine?

@jeremypw
Copy link
Collaborator Author

I can reproduce it on OS8 (Wayland) but not on OS7.1. Here is the backtrace:

Thread 1 "io.elementary.c" received signal SIGSEGV, Segmentation fault.
0x00007ffff711b34c in hdy_tab_page_set_icon () from /lib/x86_64-linux-gnu/libhandy-1.so.0
(gdb) bt
#0  0x00007ffff711b34c in hdy_tab_page_set_icon () at /lib/x86_64-linux-gnu/libhandy-1.so.0
#1  0x00005555555c9bbb in scratch_services_document_set_icon
    (self=0x555556635c60, value=0x555556635ed0) at ../src/Services/Document.vala:111
#2  0x00005555555c9d2a in scratch_services_document_set_locked (self=0x555556635c60, value=1)
    at ../src/Services/Document.vala:130
#3  0x00005555555bc27e in scratch_services_document_open_co (_data_=0x5555562debb0)
    at ../src/Services/Document.vala:342
#4  0x00005555555bbc1f in scratch_services_document_open
    (self=0x555556635c60, force=0, _callback_=0x5555555e1580 <___lambda45__gasync_ready_callback>, _user_data_=0x55555671e1c0) at ../src/Services/Document.vala:29
#5  0x00005555555e1608 in __lambda40_ (_data31_=0x55555671e1c0)
    at ../src/Widgets/DocumentView.vala:351
#6  0x00005555555e1630 in ___lambda40__gsource_func (self=0x55555671e1c0)
    at /home/jeremy/Elementary/code/build/DocumentView.c:1915
#7  0x00007ffff7ebf48e in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007ffff7f1e717 in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007ffff7ebea53 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007ffff7d7988d in g_application_run () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#11 0x0000555555581fec in scratch_application_main (args=0x7fffffffda08, args_length1=1)
    at ../src/Application.vala:200
#12 0x0000555555582039 in main (argc=1, argv=0x7fffffffda08) at ../src/Application.vala:199
(gdb) 

I'll try and investigate further when I have time.

@jeremypw
Copy link
Collaborator Author

Not sure if it matters, but the parent folder appears below the child folder in the sidebar.

@jeremypw
Copy link
Collaborator Author

Presumably something to do with the document having an ambiguous project associated with it.

@jeremypw
Copy link
Collaborator Author

In OS7.1 the document simply does not open - there is no crash. There are other weird side-effects though, like you cannot change the active project. The OS8 is running in a VM but I don't see why that should matter.

@kaixoo
Copy link

kaixoo commented Dec 23, 2024

Could it be something to do with Wayland? Can you try in X11? I can open and browser a nested folder fine. I can't close the folder after it's been open IF the parent folder is expanded, though. That's odd.

@jeremypw
Copy link
Collaborator Author

Happens in OS8/X11 too. Another possibility is that it is a race of some kind and the VM is slower than running on bare metal so the outcome is different.

@kaixoo
Copy link

kaixoo commented Dec 24, 2024

I can try to see if I can reproduce in my old laptop. Even if it was slower, it shouldn't be a reason to crash tho.

@jeremypw
Copy link
Collaborator Author

I am working on fixing it in 7.1 where it doesn't crash but also does not open the desired document. I have narrowed the problem down to the fact that the document is closed in one thread while it is being opened in another. This is because of the intended behaviour that when the active project changes, documents belonging to another project are closed. But in this situation where the document belongs to two projects it is both opened and closed simultaneously which results in destroyed objects potentially being referenced.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Dec 24, 2024

I have pushed a PR to work around this issue that was developed on 7.1 but also works on 8. I think it will take too much refactoring of Code to make it possible to have parent-child projects simultaneously open. I cannot see any particular advantage of that at the moment. All the relevant files are accessible through the parent project. I don't think git allows a repository to be a subfolder of another repository anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Critical e.g. security implications or reproducible crashing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants