Bug 426538

Summary: current git master 5.7.0-13 crashes when clicking on the datebar below the histogram
Product: [Applications] kphotoalbum Reporter: Andreas Schleth <schleth_es>
Component: DatebarAssignee: KPhotoAlbum Bugs <kphotoalbum-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: johannes, tl
Priority: NOR    
Version First Reported In: GIT master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: screenshot with marked area that causes the crash

Description Andreas Schleth 2020-09-14 20:54:48 UTC
Created attachment 131651 [details]
screenshot with marked area that causes the crash

Reproducibly, KPA crashes, when I click somewhere on the date bar below the histogram. 

It even gives some sort of error message:

...
[100%] Built target kphotoalbum 
  ((then my script starts kphotoalbum --demo))
QSocketNotifier: Invalid socket 9 and type 'Read', disabling...
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
Unable to start Dr. Konqi 
  (( this from my system))
Re-raising signal for core dump handling.
ASSERT failure in DateBarWidget::unitAtPos: "horizontal offset larger than m_barWidth!", file /home/usr/src/kphotoalbum-git/kphotoalbum/DateBar/DateBarWidget.cpp, line 835
KCrash: Application 'kphotoalbum' crashing...

Linux/KDE Plasma: openSuse Leap 15.2
(available in About System)
KDE Plasma Version: 5.71.0
KDE Frameworks Version: 5.71.0
Qt Version: 5.12.7
Comment 1 Tobias Leupold 2020-09-14 21:01:30 UTC
I don't know yet what causes this, but I can confirm it.
Comment 2 Johannes Zarl-Zierl 2020-09-14 21:14:06 UTC
I can't reproduce this here. Can someone post a stack trace?
Comment 3 Tobias Leupold 2020-09-14 21:15:06 UTC
Johannes, could it be that the assert call is wrong?

I never worked on this class, but it seems that it compares the mouse cursor position minus the left offset of the date bar with the segment width (which is 15 px in my case), thus almost always causing the assertion ...
Comment 4 Tobias Leupold 2020-09-14 21:19:10 UTC
It's caused by the Q_ASSERT_X call. I think this won't show up if a release build is done, only in debug mode.
Comment 5 Johannes Zarl-Zierl 2020-09-14 21:49:34 UTC
I missed the assertion message in my first reading.
Yes, the assertion is incorrect - I'll push a fix asap...
Comment 6 Johannes Zarl-Zierl 2020-09-14 21:51:06 UTC
Git commit 9bc2650cc565f4b3b376017b75ef8f23f841e0ec by Johannes Zarl-Zierl.
Committed on 14/09/2020 at 21:49.
Pushed by johanneszarl into branch 'master'.

DateBarWidget: fix assertion.

M  +1    -1    DateBar/DateBarWidget.cpp
M  +1    -1    DateBar/DateBarWidget.h

https://invent.kde.org/graphics/kphotoalbum/commit/9bc2650cc565f4b3b376017b75ef8f23f841e0ec
Comment 7 Andreas Schleth 2020-09-15 16:43:38 UTC
I can confirm that this fix solves this issue.
That was quick! Thanks!