Skip to content

Commit

Permalink
Fix crash in AdBlockSubscriptionDownloadManagerGetterImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
spylogsster committed Aug 18, 2022
1 parent 074b891 commit e73b6ab
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/singleton.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
Expand Down Expand Up @@ -90,7 +91,8 @@ class AdBlockSubscriptionDownloadManagerGetterImpl
AdBlockSubscriptionDownloadManagerGetterImpl(
base::OnceCallback<void(AdBlockSubscriptionDownloadManager*)> callback)
: callback_(std::move(callback)) {
g_browser_process->profile_manager()->AddObserver(this);
profile_manager_ = g_browser_process->profile_manager();
profile_manager_->AddObserver(this);
}

private:
Expand All @@ -102,10 +104,11 @@ class AdBlockSubscriptionDownloadManagerGetterImpl
}

void OnProfileManagerDestroying() override {
g_browser_process->profile_manager()->RemoveObserver(this);
profile_manager_->RemoveObserver(this);
delete this;
}

raw_ptr<ProfileManager> profile_manager_;
base::OnceCallback<void(AdBlockSubscriptionDownloadManager*)> callback_;
};

Expand Down

0 comments on commit e73b6ab

Please sign in to comment.