Bug 808510 - Initialize AllPagesHandler in constructor. r=lucasr
authorBrian Nicholson <bnicholson@mozilla.com>
Thu, 15 Nov 2012 12:36:28 -0800
changeset 113412 36cbc160b7488ce7eaf9ec327fca6f0d088a956d
parent 113411 b178e727b84d838c0f43f37e707aeb7691a225d1
child 113413 fdad0a320e7d96494ada3014df2824540871cfcd
push id23872
push useremorley@mozilla.com
push dateFri, 16 Nov 2012 17:06:27 +0000
treeherdermozilla-central@a7ed19f7d21a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs808510
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 808510 - Initialize AllPagesHandler in constructor. r=lucasr
mobile/android/base/awesomebar/AllPagesTab.java
--- a/mobile/android/base/awesomebar/AllPagesTab.java
+++ b/mobile/android/base/awesomebar/AllPagesTab.java
@@ -90,16 +90,18 @@ public class AllPagesTab extends Awesome
     }
 
     public AllPagesTab(Context context) {
         super(context);
         mSearchEngines = new ArrayList<SearchEngine>();
 
         registerEventListener("SearchEngines:Data");
         GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null));
+
+        mHandler = new AllPagesHandler();
     }
 
     public boolean onBackPressed() {
         return false;
     }
 
     public int getTitleStringId() {
         return R.string.awesomebar_all_pages_title;
@@ -128,39 +130,35 @@ public class AllPagesTab extends Awesome
                 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                      handleItemClick(parent, view, position, id);
                 }
             });
 
             AwesomeBarCursorAdapter adapter = getCursorAdapter();
             list.setAdapter(adapter);
             list.setOnTouchListener(mListListener);
-
-            mHandler = new AllPagesHandler();
         }
 
         return mView;
     }
 
     public void destroy() {
         AwesomeBarCursorAdapter adapter = getCursorAdapter();
         unregisterEventListener("SearchEngines:Data");
         if (adapter == null) {
             return;
         }
 
         Cursor cursor = adapter.getCursor();
         if (cursor != null)
             cursor.close();
 
-        if (mHandler != null) {
-            mHandler.removeMessages(MESSAGE_UPDATE_FAVICONS);
-            mHandler.removeMessages(MESSAGE_LOAD_FAVICONS);
-            mHandler = null;
-        }
+        mHandler.removeMessages(MESSAGE_UPDATE_FAVICONS);
+        mHandler.removeMessages(MESSAGE_LOAD_FAVICONS);
+        mHandler = null;
     }
 
     public void filter(String searchTerm) {
         AwesomeBarCursorAdapter adapter = getCursorAdapter();
         adapter.filter(searchTerm);
 
         filterSuggestions(searchTerm);
         if (mSuggestionsOptInPrompt != null) {