Commit: c4d8e28aa7043d7b7774d5b88ef454ba4d3e81ce Author: Julian Eisel Date: Wed Jul 20 17:13:15 2022 +0200 Branches: master https://developer.blender.org/rBc4d8e28aa7043d7b7774d5b88ef454ba4d3e81ce
UI: Remove redundant view reference in view items The new view item base class already holds a reference to the view, no need to have one in the derived class as well. =================================================================== M source/blender/editors/include/UI_grid_view.hh M source/blender/editors/interface/views/grid_view.cc =================================================================== diff --git a/source/blender/editors/include/UI_grid_view.hh b/source/blender/editors/include/UI_grid_view.hh index 805198f38ef..402c0c8512f 100644 --- a/source/blender/editors/include/UI_grid_view.hh +++ b/source/blender/editors/include/UI_grid_view.hh @@ -36,8 +36,6 @@ class AbstractGridViewItem : public AbstractViewItem { friend class AbstractGridView; friend class GridViewLayoutBuilder; - const AbstractGridView *view_; - protected: /** Reference to a string that uniquely identifies this item in the view. */ StringRef identifier_{}; diff --git a/source/blender/editors/interface/views/grid_view.cc b/source/blender/editors/interface/views/grid_view.cc index 54ed3fe1631..52ff1460cbd 100644 --- a/source/blender/editors/interface/views/grid_view.cc +++ b/source/blender/editors/interface/views/grid_view.cc @@ -29,8 +29,6 @@ AbstractGridViewItem &AbstractGridView::add_item(std::unique_ptr<AbstractGridVie items_.append(std::move(item)); AbstractGridViewItem &added_item = *items_.last(); - added_item.view_ = this; - item_map_.add(added_item.identifier_, &added_item); register_item(added_item); @@ -181,7 +179,7 @@ const AbstractGridView &AbstractGridViewItem::get_view() const throw std::runtime_error( "Invalid state, item must be added through AbstractGridView::add_item()"); } - return *view_; + return dynamic_cast<AbstractGridView &>(*view_); } /* ---------------------------------------------------------------------- */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs