Bug 461957

Summary: Subtitle UI can corrupt project file and cause Melt to crash
Product: [Applications] kdenlive Reporter: Lukas Winkler <kde>
Component: Rendering & ExportAssignee: Jean-Baptiste Mardelle <jb>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version First Reported In: 22.08.3   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Lukas Winkler 2022-11-17 17:35:25 UTC
SUMMARY

(This was discussed in the Kdenlive Telegram channel and is summarized here)

One project (that coincidentally was right after updating Melt to 7.10.0) didn't export any more when parallel processing was enabled. The log didn't show any more details, but running melt on the .mlt file manually showed that it crashed with a segmentation fault. While debugging, I realized that a newer version of the project worked fine.
It turns out that some UI actions can get Kdenlive into a state where it stores 
```
<property name="kdenlive:docproperties.activeTrack">-2</property>
```
in the project and the .mlt file which causes melt to crash.

STEPS TO REPRODUCE

(This mostly happens when randomly doing some actions with the subtitle track, but I found one method that reproduces this reliably)

1. create an empty project
2. drag an srt file into the tracks and confirm the import
3. select the subtitle track
4. save (the project file is fine)
5. undo the import
6. select the subtitle track
7. save (now `activeTrack` is set to `-2` in the project file)

SOFTWARE/OS VERSIONS

Linux: Debian Testing
KDE Frameworks Version: 5.98.0
Qt Version: 5.56.6
Melt: 7.10.0 (with a patch for https://github.com/mltframework/mlt/issues/839 applied)

ADDITIONAL INFORMATION
Comment 1 Lukas Winkler 2022-11-17 17:48:50 UTC
This might be working as intended and something else is crashing melt:
https://t.me/kdenlive/60531
Comment 2 Lukas Winkler 2022-11-17 18:01:11 UTC
Indeed the actual issue is 
https://sourceforge.net/p/mlt/mailman/mlt-devel/thread/4783636.31r3eYUQgx%40six-yoga/