Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
c2ab35bd
Commit
c2ab35bd
authored
Mar 19, 2020
by
Thakee Nathees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed: saving gdscript with cyclic inheritance crash the editor
Fix: #9609
parent
ff5dfcdf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
gdscript.cpp
modules/gdscript/gdscript.cpp
+26
-3
gdscript.h
modules/gdscript/gdscript.h
+1
-1
No files found.
modules/gdscript/gdscript.cpp
View file @
c2ab35bd
...
...
@@ -376,10 +376,15 @@ void GDScript::_update_exports_values(Map<StringName, Variant> &values, List<Pro
}
#endif
bool
GDScript
::
_update_exports
()
{
bool
GDScript
::
_update_exports
(
bool
*
r_err
,
bool
p_recursive_call
)
{
#ifdef TOOLS_ENABLED
static
Vector
<
GDScript
*>
base_caches
;
if
(
!
p_recursive_call
)
base_caches
.
clear
();
base_caches
.
append
(
this
);
bool
changed
=
false
;
if
(
source_changed_cache
)
{
...
...
@@ -473,7 +478,22 @@ bool GDScript::_update_exports() {
placeholder_fallback_enabled
=
false
;
if
(
base_cache
.
is_valid
()
&&
base_cache
->
is_valid
())
{
if
(
base_cache
->
_update_exports
())
{
for
(
int
i
=
0
;
i
<
base_caches
.
size
();
i
++
)
{
if
(
base_caches
[
i
]
==
base_cache
.
ptr
())
{
if
(
r_err
)
*
r_err
=
true
;
valid
=
false
;
// to show error in the editor
base_cache
->
valid
=
false
;
base_cache
->
inheriters_cache
.
clear
();
// to prevent future stackoverflows
base_cache
.
unref
();
base
.
unref
();
_base
=
nullptr
;
ERR_FAIL_V_MSG
(
false
,
"Cyclic inheritance in script class."
);
}
}
if
(
base_cache
->
_update_exports
(
r_err
,
true
))
{
if
(
r_err
&&
*
r_err
)
return
false
;
changed
=
true
;
}
}
...
...
@@ -501,7 +521,10 @@ void GDScript::update_exports() {
#ifdef TOOLS_ENABLED
_update_exports
();
bool
cyclic_error
=
false
;
_update_exports
(
&
cyclic_error
);
if
(
cyclic_error
)
return
;
Set
<
ObjectID
>
copy
=
inheriters_cache
;
//might get modified
...
...
modules/gdscript/gdscript.h
View file @
c2ab35bd
...
...
@@ -135,7 +135,7 @@ class GDScript : public Script {
#endif
bool
_update_exports
();
bool
_update_exports
(
bool
*
r_err
=
nullptr
,
bool
p_recursive_call
=
false
);
void
_save_orphaned_subclasses
();
void
_init_rpc_methods_properties
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment