Fix editor crash in built-in help when script inheritance chain changes.
This commit is contained in:
parent
35004aea48
commit
ec8e91e3cd
@ -323,10 +323,11 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() {
|
|||||||
|
|
||||||
bool EditorHelpSearch::Runner::_phase_match_classes() {
|
bool EditorHelpSearch::Runner::_phase_match_classes() {
|
||||||
DocData::ClassDoc &class_doc = iterator_doc->value;
|
DocData::ClassDoc &class_doc = iterator_doc->value;
|
||||||
|
if (class_doc.name.is_empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!_is_class_disabled_by_feature_profile(class_doc.name)) {
|
if (!_is_class_disabled_by_feature_profile(class_doc.name)) {
|
||||||
matches[class_doc.name] = ClassMatch();
|
ClassMatch match;
|
||||||
ClassMatch &match = matches[class_doc.name];
|
|
||||||
|
|
||||||
match.doc = &class_doc;
|
match.doc = &class_doc;
|
||||||
|
|
||||||
// Match class name.
|
// Match class name.
|
||||||
@ -400,6 +401,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
matches[class_doc.name] = match;
|
||||||
}
|
}
|
||||||
matches[class_doc.name] = match;
|
matches[class_doc.name] = match;
|
||||||
}
|
}
|
||||||
@ -419,6 +421,9 @@ bool EditorHelpSearch::Runner::_phase_class_items_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EditorHelpSearch::Runner::_phase_class_items() {
|
bool EditorHelpSearch::Runner::_phase_class_items() {
|
||||||
|
if (!iterator_match) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ClassMatch &match = iterator_match->value;
|
ClassMatch &match = iterator_match->value;
|
||||||
|
|
||||||
if (search_flags & SEARCH_SHOW_HIERARCHY) {
|
if (search_flags & SEARCH_SHOW_HIERARCHY) {
|
||||||
@ -444,6 +449,13 @@ bool EditorHelpSearch::Runner::_phase_member_items_init() {
|
|||||||
bool EditorHelpSearch::Runner::_phase_member_items() {
|
bool EditorHelpSearch::Runner::_phase_member_items() {
|
||||||
ClassMatch &match = iterator_match->value;
|
ClassMatch &match = iterator_match->value;
|
||||||
|
|
||||||
|
if (!match.doc) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (match.doc->name.is_empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY) ? class_items[match.doc->name] : root_item;
|
TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY) ? class_items[match.doc->name] : root_item;
|
||||||
bool constructor_created = false;
|
bool constructor_created = false;
|
||||||
for (int i = 0; i < match.methods.size(); i++) {
|
for (int i = 0; i < match.methods.size(); i++) {
|
||||||
@ -511,6 +523,9 @@ void EditorHelpSearch::Runner::_match_item(TreeItem *p_item, const String &p_tex
|
|||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_match) {
|
TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_match) {
|
||||||
|
if (p_match.doc->name.is_empty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
if (class_items.has(p_match.doc->name)) {
|
if (class_items.has(p_match.doc->name)) {
|
||||||
return class_items[p_match.doc->name];
|
return class_items[p_match.doc->name];
|
||||||
}
|
}
|
||||||
@ -522,9 +537,11 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_
|
|||||||
parent = class_items[p_match.doc->inherits];
|
parent = class_items[p_match.doc->inherits];
|
||||||
} else {
|
} else {
|
||||||
ClassMatch &base_match = matches[p_match.doc->inherits];
|
ClassMatch &base_match = matches[p_match.doc->inherits];
|
||||||
|
if (base_match.doc) {
|
||||||
parent = _create_class_hierarchy(base_match);
|
parent = _create_class_hierarchy(base_match);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TreeItem *class_item = _create_class_item(parent, p_match.doc, !p_match.name);
|
TreeItem *class_item = _create_class_item(parent, p_match.doc, !p_match.name);
|
||||||
class_items[p_match.doc->name] = class_item;
|
class_items[p_match.doc->name] = class_item;
|
||||||
|
@ -99,7 +99,7 @@ class EditorHelpSearch::Runner : public RefCounted {
|
|||||||
int phase = 0;
|
int phase = 0;
|
||||||
|
|
||||||
struct ClassMatch {
|
struct ClassMatch {
|
||||||
DocData::ClassDoc *doc;
|
DocData::ClassDoc *doc = nullptr;
|
||||||
bool name = false;
|
bool name = false;
|
||||||
Vector<DocData::MethodDoc *> constructors;
|
Vector<DocData::MethodDoc *> constructors;
|
||||||
Vector<DocData::MethodDoc *> methods;
|
Vector<DocData::MethodDoc *> methods;
|
||||||
|
Loading…
Reference in New Issue
Block a user