Segfault when deleting scene

The issues found when using the Function Manager panel
Post Reply
DoctorSelar
Posts: 5
Joined: Sun May 03, 2015 5:38 pm
Real Name:

Hello,

I'm experiencing a segfault when deleting a scene. I believe I've tracked down the issue, but I'm not sure how to fix it.

Steps to reproduce:
  1. Create new workspace/load from disk
  2. Create scene in Functions
  3. Create show in Shows
  4. Add created scene to the show
  5. Delete created scene in Functions
If it doesn't segfault immediately, it does when clicking on the sequence that was created automatically when you add the scene to the show.

From debugging, I've found that the scene in question has m_visible set to false (and is appropriately hidden once the workspace is saved and reloaded) but is still shown in the function manager. Once it's deleted, the associated sequence is bound to a non-existent scene. It should not be the case that this scene can be deleted manually, since it's already deleted once the last associated sequence is; I suspect there is a missing call to update the functions list after adding the scene to the show.

I'm running QLC+ on Linux, but from the nature of the bug I don't believe that the problem is platform-specific. I also cannot share an example workspace due to the fact that this bug only occurs for scenes not loaded from disk.
User avatar
mcallegari
Posts: 4711
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

DoctorSelar
Posts: 5
Joined: Sun May 03, 2015 5:38 pm
Real Name:

I've tested it on the test release posted in that thread and it's still there. The issue with that bug is deleting the last sequence associated with a bound scene and then still having a track bound to the scene, whereas this one is deleting a bound scene (which shouldn't be possible).

I've written a patch that fixes it for me, but I'm unfamiliar with the codebase (and Qt in general) so it might not be what you're looking for. What I did was add an extra signal to the Function class called visibilityChanged which is passed through Doc and FunctionManager to the FunctionsTreeWidget instance (I followed the Function's changed signal when I implemented it), which then calls updateTree().

I'd rather just have the specific function removed from the tree, but the functions in FunctionsTreeWidget for retrieving the actual tree item corresponding to a Function return NULL if the function is not visible, so they would likely need to be modified as well and I thought I'd see if I was on the right track first.
Attachments
fix-scene-visibility-update.patch
(5.14 KiB) Downloaded 118 times
User avatar
mcallegari
Posts: 4711
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Ok, I've seen it.
This is the reason why Scenes used by Sequences are hidden now.
This case is not handled and it can only lead to bad things.

[EDIT] fixed on GIT
DoctorSelar
Posts: 5
Joined: Sun May 03, 2015 5:38 pm
Real Name:

I've tested the git version (including commit c89fe68588507e7d89ad5424d62e140aebf0f0e7, "ShowManager: fix crash when editing a Sequence bound to a deleted Scene") and the issue is still there. The problem is in the Function Manager---once the scene is deleted there, the associated sequence is still there and will segfault when clicked on (in the Function Manager). My patch was to ensure that when the visibilty of scenes is changed, the FunctionsTreeWidget will be updated to reflect that visibility and thus prevent the deletion of the bound scene in the first place.
User avatar
mcallegari
Posts: 4711
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

I've pushed another change and fixed the crash also in Function Manager.
DoctorSelar
Posts: 5
Joined: Sun May 03, 2015 5:38 pm
Real Name:

The patch fixed the segfault but there's now a different (related) bug:
  1. Create workspace
  2. Create scene in function manager
  3. Create show in Shows
  4. Add created scene to show
  5. Delete created scene in function manager
Now the auto-created sequence persists (in an uneditable state) on the show track. It disappears from the show when the workspace is saved and reloaded but is still present in the function manager and cannot be edited (see "New Sequence 2" in the attached workspace). It can still be deleted without issue.

I'm convinced that the best solution is still to update the FunctionsTreeWidget code to hide the bound scene (thus preventing the deletion) or at least disallow deletion of invisible scenes.
Attachments
test.qxw
(2.04 KiB) Downloaded 95 times
Post Reply