fix crash in threaded quick search, r/sr=neil 464802
authorDavid Bienvenu <bienvenu@nventure.com>
Fri, 14 Nov 2008 10:27:40 -0800
changeset 1108 ebcb28433bfeff0f3dd9dc84bef905ac42ef1da6
parent 1107 9413bd7950162a781c8d8c0f2a4df13216752505
child 1109 66e6db37bcc5f172b24fd95340bf33a46ec2c482
push id840
push userbienvenu@nventure.com
push dateFri, 14 Nov 2008 18:27:44 +0000
treeherdercomm-central@ebcb28433bfe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs464802
fix crash in threaded quick search, r/sr=neil 464802
mailnews/base/src/nsMsgThreadedDBView.cpp
--- a/mailnews/base/src/nsMsgThreadedDBView.cpp
+++ b/mailnews/base/src/nsMsgThreadedDBView.cpp
@@ -781,19 +781,24 @@ void nsMsgThreadedDBView::MoveThreadAt(n
       threadKeys.AppendElement(m_keys[index]);
       threadFlags.AppendElement(m_flags[index]);
       threadLevels.AppendElement(m_levels[index]);
     }
     PRUint32 collapseCount;
     CollapseByIndex(threadIndex, &collapseCount);
   }
   nsMsgDBView::RemoveByIndex(threadIndex);
-  nsMsgViewIndex newIndex;
+  nsMsgViewIndex newIndex = nsMsgViewIndex_None;
   AddHdr(threadHdr, &newIndex);
 
+  // AddHdr doesn't always set newIndex, and getting it to do so
+  // is going to require some refactoring.
+  if (newIndex == nsMsgViewIndex_None)
+    newIndex = FindHdr(threadHdr);
+
   if (threadIsExpanded)
   {
     m_keys.InsertElementsAt(newIndex + 1, threadKeys);
     m_flags.InsertElementsAt(newIndex + 1, threadFlags);
     m_levels.InsertElementsAt(newIndex + 1, threadLevels);
   }
   m_flags[newIndex] = saveFlags;
   // unfreeze selection.