Last Comment Bug 822131 - Remove nsISupportsArray usage from nsIMsgFilterService::applyFiltersToFolders and nsMsgFilterAfterTheFact::nsMsgFilterAfterTheFact
: Remove nsISupportsArray usage from nsIMsgFilterService::applyFiltersToFolders...
Status: RESOLVED FIXED
:
Product: MailNews Core
Classification: Components
Component: Filters (show other bugs)
: Trunk
: All All
: -- trivial (vote)
: Thunderbird 20.0
Assigned To: :aceman
:
Mentors:
http://mxr.mozilla.org/comm-central/i...
Depends on:
Blocks: 394167
  Show dependency treegraph
 
Reported: 2012-12-16 13:37 PST by :aceman
Modified: 2012-12-30 16:36 PST (History)
3 users (show)
ryanvm: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch (16.92 KB, patch)
2012-12-16 14:39 PST, :aceman
neil: review-
Details | Diff | Splinter Review
patch v2 (15.76 KB, patch)
2012-12-21 11:58 PST, :aceman
neil: review+
rkent: review+
Details | Diff | Splinter Review

Description :aceman 2012-12-16 13:37:00 PST
I'll try to change the aFolders argument of nsIMsgFilterService::applyFiltersToFolders to nsIArray.
Comment 1 :aceman 2012-12-16 14:39:37 PST
Created attachment 692779 [details] [diff] [review]
patch
Comment 2 neil@parkwaycc.co.uk 2012-12-16 17:14:35 PST
Comment on attachment 692779 [details] [diff] [review]
patch

>-  nsCOMPtr <nsIMsgWindow>     m_msgWindow;
>-  nsCOMPtr <nsIMsgFilterList> m_filters;
>-  nsCOMPtr <nsISupportsArray> m_folders;
>-  nsCOMPtr <nsIMsgFolder>     m_curFolder;
>-  nsCOMPtr <nsIMsgDatabase>   m_curFolderDB;
>-  nsCOMPtr <nsIMsgFilter>     m_curFilter;
>+  nsCOMPtr<nsIMsgWindow>      m_msgWindow;
>+  nsCOMPtr<nsIMsgFilterList>  m_filters;
>+  nsCOMPtr<nsIArray>          m_folders;
>+  nsCOMPtr<nsIMsgFolder>      m_curFolder;
>+  nsCOMPtr<nsIMsgDatabase>    m_curFolderDB;
>+  nsCOMPtr<nsIMsgFilter>      m_curFilter;
>   uint32_t                    m_curFilterIndex;
>   uint32_t                    m_curFolderIndex;
>   uint32_t                    m_numFilters;
>   uint32_t                    m_numFolders;
>   nsTArray<nsMsgKey>          m_searchHits;
>   nsCOMPtr<nsIMutableArray>   m_searchHitHdrs;
>-  nsCOMPtr <nsIMsgSearchSession> m_searchSession;
>+  nsCOMPtr<nsIMsgSearchSession> m_searchSession;
[I wish you didn't reformat stuff, it makes the real change harder to spot...]

>-nsMsgFilterAfterTheFact::nsMsgFilterAfterTheFact(nsIMsgWindow *aMsgWindow, nsIMsgFilterList *aFilterList, nsISupportsArray *aFolderList)
>+nsMsgFilterAfterTheFact::nsMsgFilterAfterTheFact(nsIMsgWindow *aMsgWindow, nsIMsgFilterList *aFilterList, nsIArray *aFolderList)
> {
>   m_curFilterIndex = m_curFolderIndex = m_nextAction = 0;
>   m_msgWindow = aMsgWindow;
>   m_filters = aFilterList;
>   m_folders = aFolderList;
[Bah, this should so be C++ initialisation...]

>-  nsresult rv = m_folders->QueryElementAt(m_curFolderIndex++, NS_GET_IID(nsIMsgFolder), getter_AddRefs(m_curFolder));
>+  nsresult rv = m_folders->QueryElementAt(m_curFolderIndex++,
>+                                          NS_GET_IID(nsIMsgFolder),
>+                                          getter_AddRefs(m_curFolder));
>   NS_ENSURE_SUCCESS(rv, rv);
>   nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
>-  rv = m_curFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(m_curFolderDB));
>+  rv = m_curFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo),
>+                                         getter_AddRefs(m_curFolderDB));
Ironically you reformatted without changing the code. There is a useful change you could have done, but I'm going to have to give you r- now. To get the r+ you can either figure out the improvement you could have made or undo the reformatting. (And fix the typo below of course.)

>+  var folders = Components.classes["@mozilla.org/supports;1"]
>+                          .createInstance(Components.interfaces.nsIMutableArray);
Typo.
Comment 3 :aceman 2012-12-17 11:41:20 PST
(In reply to neil@parkwaycc.co.uk from comment #2)
> >-  nsresult rv = m_folders->QueryElementAt(m_curFolderIndex++, NS_GET_IID(nsIMsgFolder), getter_AddRefs(m_curFolder));
> >+  nsresult rv = m_folders->QueryElementAt(m_curFolderIndex++,
> >+                                          NS_GET_IID(nsIMsgFolder),
> >+                                          getter_AddRefs(m_curFolder));
> >   NS_ENSURE_SUCCESS(rv, rv);
> >   nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
> >-  rv = m_curFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(m_curFolderDB));
> >+  rv = m_curFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo),
> >+                                         getter_AddRefs(m_curFolderDB));
> Ironically you reformatted without changing the code. There is a useful
> change you could have done, but I'm going to have to give you r- now. To get
> the r+ you can either figure out the improvement you could have made or undo
> the reformatting. (And fix the typo below of course.)
Does it hide inside the lines I have changed or is it in the lines between? :)
Comment 4 neil@parkwaycc.co.uk 2012-12-17 16:27:44 PST
(In reply to aceman from comment #3)
> Does it hide inside the lines I have changed or is it in the lines between?
It's in one of the lines you changed.
Comment 5 :aceman 2012-12-21 11:58:31 PST
Created attachment 694938 [details] [diff] [review]
patch v2
Comment 6 Ryan VanderMeulen [:RyanVM] 2012-12-30 16:36:39 PST
https://hg.mozilla.org/comm-central/rev/60503161ac00

Note You need to log in before you can comment on or make changes to this bug.