From 5194287645f00f95a55fcd939398629ba22f608f Mon Sep 17 00:00:00 2001 From: mr-alice Date: Sat, 27 Aug 2016 13:22:29 +0200 Subject: [PATCH] fixed SEGV due to calling layout change in the wrong place --- libretroshare/src/file_sharing/p3filelists.cc | 11 +++++++++-- retroshare-gui/src/gui/RemoteDirModel.cpp | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 768ce370c..a1b98af65 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -443,7 +443,11 @@ int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags } else { - d.prow = storage->parentRow(e) ; + if(d.parent == 0) // child of root node + d.prow = (flags & RS_FILE_HINTS_LOCAL)?0:(fi-1); + else + d.prow = storage->parentRow(e) ; + convertEntryIndexToPointer((intptr_t)d.parent,fi,d.parent) ; } @@ -480,7 +484,10 @@ uint32_t p3FileDatabase::getType(void *ref) const if(e == 0) 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 diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index 295ebbf83..9ccbc43ad 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -862,6 +862,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const /* Callback from */ void RetroshareDirModel::preMods() { + emit layoutAboutToBeChanged(); #if QT_VERSION < 0x050000 reset(); #else @@ -877,7 +878,7 @@ void RetroshareDirModel::preMods() /* Callback from */ void RetroshareDirModel::postMods() { - emit layoutAboutToBeChanged(); +// emit layoutAboutToBeChanged(); #if QT_VERSION >= 0x040600 beginResetModel(); #endif