Merge lp:~tiagosh/history-service/fix-qt52 into lp:history-service

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 130
Merged at revision: 130
Proposed branch: lp:~tiagosh/history-service/fix-qt52
Merge into: lp:history-service
Diff against target: 70 lines (+19/-15)
2 files modified
Ubuntu/History/historyeventmodel.cpp (+9/-7)
Ubuntu/History/historythreadmodel.cpp (+10/-8)
To merge this branch: bzr merge lp:~tiagosh/history-service/fix-qt52
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+204728@code.launchpad.net

Commit message

Check if the model is already empty before removing items in order to avoid an assert() in qt 5.2.

Description of the change

Check if the model is already empty before removing items in order to avoid an assert() in qt 5.2.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~tiagosh/telepathy-ofono/telepathy-ofono-groupchat/+merge/204321

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes.

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/history-service) on device or emulator?
Yes.

If you changed the UI, was the change specified/approved by design?
No UI changes.

If you changed the packaging (debian), did you subscribe a core-dev to this MP?
No packaging changes.

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

> Are there any related MPs required for this MP to build/function as expected?
> Please list.
> https://code.launchpad.net/~tiagosh/telepathy-ofono/telepathy-ofono-
> groupchat/+merge/204321
>

Actually, there are no dependencies. Please, ignore the link above.

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/history-service) on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

Code looks good and works as expected.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Ubuntu/History/historyeventmodel.cpp'
2--- Ubuntu/History/historyeventmodel.cpp 2013-12-09 21:18:14 +0000
3+++ Ubuntu/History/historyeventmodel.cpp 2014-02-04 16:25:58 +0000
4@@ -194,11 +194,11 @@
5 qDebug() << "Got events:" << events.count();
6 if (events.isEmpty()) {
7 mCanFetchMore = false;
8+ } else {
9+ beginInsertRows(QModelIndex(), mEvents.count(), mEvents.count() + events.count() - 1);
10+ mEvents << events;
11+ endInsertRows();
12 }
13-
14- beginInsertRows(QModelIndex(), mEvents.count(), mEvents.count() + events.count() - 1);
15- mEvents << events;
16- endInsertRows();
17 }
18
19 QHash<int, QByteArray> HistoryEventModel::roleNames() const
20@@ -307,9 +307,11 @@
21 void HistoryEventModel::updateQuery()
22 {
23 // remove all events from the model
24- beginRemoveRows(QModelIndex(), 0, mEvents.count() - 1);
25- mEvents.clear();
26- endRemoveRows();
27+ if (!mEvents.isEmpty()) {
28+ beginRemoveRows(QModelIndex(), 0, mEvents.count() - 1);
29+ mEvents.clear();
30+ endRemoveRows();
31+ }
32
33 // and create the view again
34 History::Filter queryFilter;
35
36=== modified file 'Ubuntu/History/historythreadmodel.cpp'
37--- Ubuntu/History/historythreadmodel.cpp 2013-12-09 21:18:14 +0000
38+++ Ubuntu/History/historythreadmodel.cpp 2014-02-04 16:25:58 +0000
39@@ -211,11 +211,11 @@
40 History::Threads threads = mThreadView->nextPage();
41 if (threads.isEmpty()) {
42 mCanFetchMore = false;
43+ } else {
44+ beginInsertRows(QModelIndex(), mThreads.count(), mThreads.count() + threads.count() - 1);
45+ mThreads << threads;
46+ endInsertRows();
47 }
48-
49- beginInsertRows(QModelIndex(), mThreads.count(), mThreads.count() + threads.count() - 1);
50- mThreads << threads;
51- endInsertRows();
52 }
53
54 QHash<int, QByteArray> HistoryThreadModel::roleNames() const
55@@ -308,10 +308,12 @@
56 void HistoryThreadModel::updateQuery()
57 {
58 // remove all events from the model
59- beginRemoveRows(QModelIndex(), 0, mThreads.count() - 1);
60- mThreads.clear();
61- endRemoveRows();
62-
63+ if (!mThreads.isEmpty()) {
64+ beginRemoveRows(QModelIndex(), 0, mThreads.count() - 1);
65+ mThreads.clear();
66+ endRemoveRows();
67+ }
68+
69 // and fetch again
70 mCanFetchMore = true;
71

Subscribers

People subscribed via source and target branches