Skip to content

Commit

Permalink
Fix mozilla-mobile#6722: no reload() datasource when app backgrounded…
Browse files Browse the repository at this point in the history
… (db closed) (mozilla-mobile#6884)
  • Loading branch information
garvankeeley authored and dnarcese committed Jul 14, 2020
1 parent 261dccd commit 02df316
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Client/Frontend/Library/BookmarkDetailPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class BookmarkDetailPanel: SiteTableViewController {
}

override func reloadData() {
// Can be called while app backgrounded and the db closed, don't try to reload the data source in this case
if profile.isShutdown { return }
profile.places.getBookmarksTree(rootGUID: BookmarkRoots.RootGUID, recursive: true).uponQueue(.main) { result in
guard let rootFolder = result.successValue as? BookmarkFolder else {
// TODO: Handle error case?
Expand Down
2 changes: 2 additions & 0 deletions Client/Frontend/Library/BookmarksPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class BookmarksPanel: SiteTableViewController, LibraryPanel {
}

override func reloadData() {
// Can be called while app backgrounded and the db closed, don't try to reload the data source in this case
if profile.isShutdown { return }
profile.places.getBookmarksTree(rootGUID: bookmarkFolderGUID, recursive: false).uponQueue(.main) { result in

guard let folder = result.successValue as? BookmarkFolder else {
Expand Down
2 changes: 2 additions & 0 deletions Client/Frontend/Library/HistoryPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class HistoryPanel: SiteTableViewController, LibraryPanel {
// MARK: - Loading data

override func reloadData() {
// Can be called while app backgrounded and the db closed, don't try to reload the data source in this case
if profile.isShutdown { return }
guard !isFetchInProgress else { return }
groupedSites = DateGroupedTableData<Site>()

Expand Down

0 comments on commit 02df316

Please sign in to comment.