2021-05-26 21:46:59 +02:00
|
|
|
From c2d0133f47afb59b4ce64e42215d1d053f15250a Mon Sep 17 00:00:00 2001
|
|
|
|
From: Stephan Hartmann <stha09@googlemail.com>
|
|
|
|
Date: Tue, 13 Apr 2021 23:21:42 +0000
|
|
|
|
Subject: [PATCH] fix crash in ThemeService
|
|
|
|
|
|
|
|
ThemeSyncableService and ThemeService are owned by each other. On
|
|
|
|
destruction of ThemeService, ThemeSyncableService gets destructed as
|
|
|
|
well, but calls RemoveObserver of partly destructed ThemeService object.
|
|
|
|
To avoid already destructed |observers_| list, move it before
|
|
|
|
|theme_syncable_service_| definition.
|
|
|
|
|
|
|
|
Bug: 1190561
|
|
|
|
Change-Id: I4dc2c990d589071d97b7fa737afef54463c84751
|
|
|
|
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2821311
|
|
|
|
Commit-Queue: Peter Kasting <pkasting@chromium.org>
|
|
|
|
Reviewed-by: Peter Kasting <pkasting@chromium.org>
|
|
|
|
Cr-Commit-Position: refs/heads/master@{#872164}
|
|
|
|
---
|
|
|
|
chrome/browser/themes/theme_service.h | 6 ++++--
|
|
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git chrome/browser/themes/theme_service.h chrome/browser/themes/theme_service.h
|
|
|
|
index 592d40ae9de0f..337dfac9a040f 100644
|
srcpkgs/c*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
for p in ${template%/template}/patches/*; do
sed -i '
\,^[+-][+-][+-] /dev/null,b
/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
s,^[*][*][*] ,&a/,
/^--- /{
s,\(^--- \)\(./\)*,\1a/,
s,[.][Oo][Rr][Ii][Gg]\([ /]\),\1,
s/[.][Oo][Rr][Ii][Gg]$//
s/[.]patched[.]\([^.]\)/.\1/
h
}
/^+++ -/{
g
s/^--- a/+++ b/
b
}
s,\(^+++ \)\(./\)*,\1b/,
' "$p"
done
sed -i '/^patch_args=/d' $template
done
```
2021-06-19 04:18:31 +02:00
|
|
|
--- a/chrome/browser/themes/theme_service.h
|
|
|
|
+++ b/chrome/browser/themes/theme_service.h
|
2021-05-26 21:46:59 +02:00
|
|
|
@@ -299,6 +299,10 @@ class ThemeService : public KeyedService,
|
|
|
|
// The number of infobars currently displayed.
|
|
|
|
int number_of_reinstallers_ = 0;
|
|
|
|
|
|
|
|
+ // Declared before |theme_syncable_service_|, because ThemeSyncableService
|
|
|
|
+ // removes itself from the |observers_| list on destruction.
|
|
|
|
+ base::ObserverList<ThemeServiceObserver> observers_;
|
|
|
|
+
|
|
|
|
std::unique_ptr<ThemeSyncableService> theme_syncable_service_;
|
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
|
@@ -320,8 +324,6 @@ class ThemeService : public KeyedService,
|
|
|
|
ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver>
|
|
|
|
native_theme_observer_{this};
|
|
|
|
|
|
|
|
- base::ObserverList<ThemeServiceObserver> observers_;
|
|
|
|
-
|
|
|
|
base::WeakPtrFactory<ThemeService> weak_ptr_factory_{this};
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ThemeService);
|