fixed SEGV due to calling layout change in the wrong place

This commit is contained in:
mr-alice 2016-08-27 13:22:29 +02:00
parent d8a24c8c3a
commit 5194287645
2 changed files with 11 additions and 3 deletions

View File

@ -443,7 +443,11 @@ int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags
} }
else else
{ {
if(d.parent == 0) // child of root node
d.prow = (flags & RS_FILE_HINTS_LOCAL)?0:(fi-1);
else
d.prow = storage->parentRow(e) ; d.prow = storage->parentRow(e) ;
convertEntryIndexToPointer((intptr_t)d.parent,fi,d.parent) ; convertEntryIndexToPointer((intptr_t)d.parent,fi,d.parent) ;
} }
@ -480,7 +484,10 @@ uint32_t p3FileDatabase::getType(void *ref) const
if(e == 0) if(e == 0)
return DIR_TYPE_PERSON ; return DIR_TYPE_PERSON ;
return mRemoteDirectories[fi]->getEntryType(e) ; if(fi == 0)
return mLocalSharedDirs->getEntryType(e) ;
else
return mRemoteDirectories[fi-1]->getEntryType(e) ;
} }
void p3FileDatabase::forceDirectoryCheck() // Force re-sweep the directories and see what's changed void p3FileDatabase::forceDirectoryCheck() // Force re-sweep the directories and see what's changed

View File

@ -862,6 +862,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
/* Callback from */ /* Callback from */
void RetroshareDirModel::preMods() void RetroshareDirModel::preMods()
{ {
emit layoutAboutToBeChanged();
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
reset(); reset();
#else #else
@ -877,7 +878,7 @@ void RetroshareDirModel::preMods()
/* Callback from */ /* Callback from */
void RetroshareDirModel::postMods() void RetroshareDirModel::postMods()
{ {
emit layoutAboutToBeChanged(); // emit layoutAboutToBeChanged();
#if QT_VERSION >= 0x040600 #if QT_VERSION >= 0x040600
beginResetModel(); beginResetModel();
#endif #endif