Skip to content

Commit e1f5502

Browse files
committed
Fixed crash when a tab is added to saved group
fix brave/brave-browser#37160 Widget is referred after group button is removed form widget.
1 parent 60482d6 commit e1f5502

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

browser/ui/views/bookmarks/saved_tab_groups/brave_saved_tab_group_button.cc

+11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ void BraveSavedTabGroupButton::Initialize() {
3838
}
3939

4040
void BraveSavedTabGroupButton::UpdateButtonLayout() {
41+
// This seems called after this class is removed from widget.
42+
// If a tab is added to existing group and that tab is the only
43+
// tab in the current window, it seems that window is closed
44+
// when that group is in another window during this adding.
45+
// I think SavedTabGroupBar should stop observing SavedTabGroupModel
46+
// when it's removed from widget but it's upstream code and upstream
47+
// doesn't have this issue.
48+
if (!GetWidget()) {
49+
return;
50+
}
51+
4152
auto* cp = GetColorProvider();
4253

4354
// Note that upstream uses separate color IDs for the button background,

0 commit comments

Comments
 (0)