Commit a4bb051c authored by Alexandre Lision's avatar Alexandre Lision

texts: fix crash at loading

the QSortFilterProxyModel used for the Smartlist gives a bad access
on a valid QModelIndex.
Instead of calling .data() on the proxy index we now use the source
index as soon as we can to prevent desynchronisation

Tuleap: #582
Change-Id: I561023e54a3acafe36b6a43d88d550d66f9e997a
parent f46768fd
......@@ -203,8 +203,10 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
QModelIndex qIdx = [treeController toQIdx:((NSTreeNode*)item)];
NSTableCellView *result;
QModelIndex proxyIdx = [treeController toQIdx:((NSTreeNode*)item)];
QModelIndex qIdx = RecentModel::instance().peopleProxy()->mapToSource(proxyIdx);
NSTableCellView* result;
if (!qIdx.parent().isValid()) {
result = [outlineView makeViewWithIdentifier:@"MainCell" owner:outlineView];
NSTextField* details = [result viewWithTag:DETAILS_TAG];
......@@ -212,7 +214,7 @@ NSInteger const CANCEL_BUTTON_TAG = 600;
NSMutableArray* controls = [NSMutableArray arrayWithObject:[result viewWithTag:CALL_BUTTON_TAG]];
[((ContextualTableCellView*) result) setContextualsControls:controls];
if (auto call = RecentModel::instance().getActiveCall(RecentModel::instance().peopleProxy()->mapToSource(qIdx))) {
if (auto call = RecentModel::instance().getActiveCall(qIdx)) {
[details setStringValue:call->roleData((int)Ring::Role::FormattedState).toString().toNSString()];
[((ContextualTableCellView*) result) setActiveState:YES];
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment