fix: NativeWindow.window_id() returns same value for all windows (#46562)

fix: NativeWindow.window_id() returns same value for all windows
This commit is contained in:
Charles Kerr 2025-04-09 10:45:06 -05:00 committed by GitHub
parent c1c74b0a6c
commit c6e6a03a24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 7 deletions

View file

@ -409,7 +409,7 @@ class NativeWindow : public base::SupportsUserData,
NativeWindow* parent() const { return parent_; }
bool is_modal() const { return is_modal_; }
int32_t window_id() const { return next_id_; }
int32_t window_id() const { return window_id_; }
void add_child_window(NativeWindow* child) {
child_windows_.push_back(child);
@ -472,7 +472,8 @@ class NativeWindow : public base::SupportsUserData,
private:
std::unique_ptr<views::Widget> widget_;
static int32_t next_id_;
static inline int32_t next_id_ = 0;
const int32_t window_id_ = ++next_id_;
// The content view, weak ref.
raw_ptr<views::View> content_view_ = nullptr;