diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index 079015cf2..762c8343e 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -458,7 +458,7 @@ void ChannelFeed::updateMessageSummaryList(const std::string &channelId) int channelItems[2] = { OWN, SUBSCRIBED }; for (int channelItem = 0; channelItem < 2; channelItem++) { - QStandardItem *groupItem = model->item(channelItem); + QStandardItem *groupItem = model->item(channelItems[channelItem]); if (groupItem == NULL) { continue; } @@ -503,7 +503,7 @@ void ChannelFeed::updateMessageSummaryList(const std::string &channelId) static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMsgSummary &msg2) { - return (msg1.ts < msg2.ts); + return (msg1.ts > msg2.ts); } void ChannelFeed::updateChannelMsgs() @@ -512,6 +512,13 @@ void ChannelFeed::updateChannelMsgs() return; } + /* replace all the messages with new ones */ + std::list::iterator mit; + for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) { + delete (*mit); + } + mChanMsgItems.clear(); + ChannelInfo ci; if (!rsChannels->getChannelInfo(mChannelId, ci)) { postButton->setEnabled(false); @@ -561,13 +568,6 @@ void ChannelFeed::updateChannelMsgs() postButton->setEnabled(false); } - /* replace all the messages with new ones */ - std::list::iterator mit; - for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) { - delete (*mit); - } - mChanMsgItems.clear(); - std::list msgs; std::list::iterator it;