We cannot nuke treestore in readfile's `blo_lib_link_screen_restore()`, because this will destroy all UI-state data (like opened/closed items, etc.). Since we cannot know for sure whether an ID pointer from tselem->id is valid here, we have to ensure they are never invalid, i.e. to always set them to NULL when we delete them. To do so, this commit uses a similar approach as what already exists for ID references in WM notifiers - it extends `free_notifier_reference_cb()` to also nullify those IDs in all outliners. Note that some ID types are not used(shown) by outliner currently, so `TREESTORE_ID_TYPE` macro was added, that checks whether an ID is possibly used by outliner. Avoids a few searches in whole tree whene deleting some IDs. Reviewers: campbellbarton, sergey Maniphest Tasks: T44439 Differential Revision: https://developer.blender.org/D1272
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
/*
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* The Original Code is Copyright (C) 2015, Blender Foundation
|
|
*
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
*/
|
|
|
|
/** \file ED_outliner.h
|
|
* \ingroup editors
|
|
*/
|
|
|
|
#ifndef __ED_OUTLINER_H__
|
|
#define __ED_OUTLINER_H__
|
|
|
|
struct ID;
|
|
struct SpaceOops;
|
|
|
|
/* Used to check whether a given texture context is valid in current context. */
|
|
void ED_outliner_id_unref(struct SpaceOops *so, const struct ID *id);
|
|
|
|
#endif /* __ED_OUTLINER_H__ */
|