Summary: | Crash when selecting a single day after scrolling the week view [EventViews::EventIndicator::enableColumn EventViews::AgendaView::updateEventIndicatorTop EventViews::Agenda::lowerYChanged checkScrollBoundaries] | ||
---|---|---|---|
Product: | [Applications] korganizer | Reporter: | Christophe Marin <christophe> |
Component: | agendaview (weekview) | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | crash | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Unlisted Binaries | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Christophe Marin
2011-01-06 15:25:38 UTC
screencast is there: http://dl.free.fr/ovmeqM0EX commit 2416d7fb1d5856bd7571075698f841f81ef4fd6d branch master Author: Sergio Martins <iamsergio@gmail.com> Date: Thu Jan 6 14:42:30 2011 +0000 Add an assert. Qt already asserts, but this makes the backtrace nicer to read. CCBUG: 262310 diff --git a/calendarviews/eventviews/agenda/agendaview.cpp b/calendarviews/eventviews/agenda/agendaview.cpp index 29135b8..ceb3544 100644 --- a/calendarviews/eventviews/agenda/agendaview.cpp +++ b/calendarviews/eventviews/agenda/agendaview.cpp @@ -160,6 +160,7 @@ void EventIndicator::changeColumns( int columns ) void EventIndicator::enableColumn( int column, bool enable ) { + Q_ASSERT( column < d->mEnabled.count() ); d->mEnabled[ column ] = enable; } commit 1c26ffc6cc90a330fad0b818490130c0ebc039d7 branch master Author: Sergio Martins <iamsergio@gmail.com> Date: Thu Jan 6 15:13:37 2011 +0000 Fix crash. Setting mEnabled and mMinY must be an atomic operation. Nothing should be executed in between. BUG: 262310 diff --git a/calendarviews/eventviews/agenda/agendaview.cpp b/calendarviews/eventviews/agenda/agendaview.cpp index ceb3544..e758019 100644 --- a/calendarviews/eventviews/agenda/agendaview.cpp +++ b/calendarviews/eventviews/agenda/agendaview.cpp @@ -257,6 +257,8 @@ class AgendaView::Private : public CalendarSupport::Calendar::CalendarObserver QDate::currentDate() is returned */ static QList<QDate> generateDateList( const QDate &start, const QDate &end ); + void changeColumns( int numColumns ); + void insertIncidence( const Akonadi::Item &incidence, const QDate &curDate, bool createSelected ); @@ -267,6 +269,18 @@ class AgendaView::Private : public CalendarSupport::Calendar::CalendarObserver void calendarIncidenceDeleted( const Akonadi::Item &incidence ); }; +void AgendaView::Private::changeColumns( int numColumns ) +{ + // mMinY, mMaxY and mEnabled must all have the same size. + // Make sure you preserve this order because mEventIndicatorTop->changeColumns() + // can trigger a lot of stuff, and code will be executed when mMinY wasn't resized yet. + mMinY.resize( numColumns ); + mMaxY.resize( numColumns ); + mEventIndicatorTop->changeColumns( numColumns ); + mEventIndicatorBottom->changeColumns( numColumns ); +} + + /** static */ QList<QDate> AgendaView::Private::generateDateList( const QDate &start, const QDate &end ) @@ -1459,15 +1473,11 @@ void AgendaView::fillAgenda() if ( changes().testFlag( DatesChanged ) ) { d->mAllDayAgenda->changeColumns( d->mSelectedDates.count() ); d->mAgenda->changeColumns( d->mSelectedDates.count() ); - d->mEventIndicatorTop->changeColumns( d->mSelectedDates.count() ); - d->mEventIndicatorBottom->changeColumns( d->mSelectedDates.count() ); + d->changeColumns( d->mSelectedDates.count() ); createDayLabels( false ); setHolidayMasks(); - d->mMinY.resize( d->mSelectedDates.count() ); - d->mMaxY.resize( d->mSelectedDates.count() ); - d->mAgenda->setDateList( d->mSelectedDates ); } |