Join GitHub today
waveformseekbar: ZeroDivisionError: float division by zero #2387
How: Quickly disable/enable the waveform seekbar plugin multiple times.
I guess it's hard to hit, so not that urgent
changed the title from
waveformseekbar: ZeroDivisionError: float division by zero
May 18, 2017
@lazka I can't reproduce it here... so I would need some more input from you.
If there is a division by zero, this means that
Should I do a blind fix and just test for
I can reproduce it. It took me 5 seconds of checking/unchecking the waveform seek bar plugin quickly to get the crash. Did you try that @ptitjes?
It seems your suggestion of testing when width * pixel_ratio = 1 should work... this is the error I got:
Traceback (most recent call last):
.../quodlibet/ext/events/waveformseekbar.py", line 122, in _on_bus_message
.../quodlibet/ext/events/waveformseekbar.py", line 138, in _update_redraw_interval
.../quodlibet/ext/events/waveformseekbar.py", line 256, in compute_redraw_interval
ZeroDivisionError: float division by zero
I see ! So I planted a
So I have a fix for this enabling/disabling quickly, which is to correctly cancel the pipeline in the destroy method:
I think that correctly cancelling the pipeline is good practice anyway so I'll add a commit just for that in my PR. However, here, the "Crash" is also triggered at startup, as the seekbar component is not yet visible but the waveform computation has finished. Do you have that too ? (or my laptop is too fast ;p)
referenced this issue
May 20, 2017
Still a problem it seems (assuming I correctly applied the fixes on quodlibet-3.9): https://sentry.io/share/issue/3134323431352e323735363939363437/
@lazka The reason for using
I guess the question is more why does the component has a width of 1 ?
Why does drawing in the middle of pixels change the amount of pixels being drawn?
The initial allocation seems to be 1x1, so maybe there is some racy stuff going on where the widget is not mapped but still called. Either way, a width of 1 is a valid size and should be handled.