Segmentation fault when selecting a clip in the timeline
Shotcut 20.06.28
Ubuntu 20.04
First time Shotcut user here. I was working on a project roughly 30 minutes long with about 15 clips and different transitions. Then it kept crashing with a segmentation fault. I narrowed it down to a single clip on my timeline. Just clicking/selecting it consistently crashes Shotcut. I then bisected the xml file and here's the only difference between working and crashing. Note that all the values inside the XML were created by Shotcut and not manually. All I did was remove the filters from the crashing XML and re-add them using Shotcut.
Left: working Right: broken

Before: working After: broken
804c804
< <filter id="filter11" in="00:00:00.200" out="00:00:24.958">
---
> <filter id="filter11" in="00:00:-7.808" out="00:00:24.958">
812c812
< <filter id="filter12" in="00:00:00.200" out="00:00:24.958">
---
> <filter id="filter12" in="00:00:-7.808" out="00:00:24.958">
814c814
< <property name="level">00:00:23.790=1;00:00:24.758=0</property>
---
> <property name="level">00:00:31.798=1;00:00:32.766=0</property>
820c820
< <filter id="filter13" in="00:00:00.200" out="00:00:24.958">
---
> <filter id="filter13" in="00:00:-7.808" out="00:00:24.958">
823c823
< <property name="level">00:00:00.000=-60;00:00:00.968=0</property>
---
> <property name="level">00:00:00.000=-60;00:00:00.133=0</property>
826c826
< <property name="shotcut:animIn">00:00:01.001</property>
---
> <property name="shotcut:animIn">00:00:00.167</property>
828c828
< <filter id="filter14" in="00:00:00.200" out="00:00:24.958">
---
> <filter id="filter14" in="00:00:-7.808" out="00:00:24.958">
831c831
< <property name="level">00:00:23.790=0;00:00:24.758=-60</property>
---
> <property name="level">00:00:31.798=0;00:00:32.766=-60</property>
Me selecting the clip in the working version
[Debug ] <TimelineDock::setSelection> Changing selection to (QPoint(7,1)) trackIndex -1 isMultitrack false
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:324: TypeError: Cannot read property 'height' of undefined
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:322: TypeError: Cannot read property 'y' of undefined
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:321: TypeError: Cannot read property 'x' of undefined
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:320: TypeError: Cannot read property 'y' of undefined
[h264 @ 0x488d080] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0xddd9dc0] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0xd432bc0] Reinit context to 1920x1088, pix_fmt: yuv420p
[Debug ] <MLT> [producer avformat] audio: total_streams 1 max_stream 1 total_channels 2 max_channels 2
[AVIOContext @ 0xdf7f940] Statistics: 227008 bytes read, 2 seeks
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 3422
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 2999
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 3001
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 2997
[h264 @ 0x4660600] Reinit context to 1920x1088, pix_fmt: yuv420p
Me selecting the clip in the broken version
[Debug ] <TimelineDock::setSelection> Changing selection to (QPoint(7,1)) trackIndex -1 isMultitrack false
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:324: TypeError: Cannot read property 'height' of undefined
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:322: TypeError: Cannot read property 'y' of undefined
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:321: TypeError: Cannot read property 'x' of undefined
[Warning] <> file:///snap/shotcut/67/Shotcut.app/share/shotcut/qml/views/timeline/timeline.qml:320: TypeError: Cannot read property 'y' of undefined
[h264 @ 0x1703e800] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x174d2a40] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0xeadac80] Reinit context to 1920x1088, pix_fmt: yuv420p
[Debug ] <MLT> [producer avformat] audio: total_streams 1 max_stream 1 total_channels 2 max_channels 2
[AVIOContext @ 0x174b7480] Statistics: 227008 bytes read, 2 seeks
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 3422
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 2999
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 3001
[Debug ] <MLT> [mlt_producer avformat-novalidate] "/some.mp4" checking VFR: pkt.duration 2997
[h264 @ 0xe827780] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x7fac8435fcc0] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x7fac84371000] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x7fac8444d540] Reinit context to 1920x1088, pix_fmt: yuv420p
[Debug ] <MLT> [producer avformat] audio: total_streams 1 max_stream 1 total_channels 2 max_channels 2
[AVIOContext @ 0x7fac84366ac0] Statistics: 227008 bytes read, 2 seeks
[AVIOContext @ 0x7fac8445fa80] Statistics: 227008 bytes read, 2 seeks
[AVIOContext @ 0x7fac8446a8c0] Statistics: 227008 bytes read, 2 seeks
[h264 @ 0x7fac8445e900] Reinit context to 1920x1088, pix_fmt: yuv420p
Segmentation fault (core dumped)
The negative time values on the filters are probably the problem. We need to figure out what steps cause them. Meanwhile, I can look for places to clamp these values to a minimum of 0 to prevent this.