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
ffbea8aa
Unverified
Commit
ffbea8aa
authored
Jun 10, 2020
by
Rémi Verschelde
Committed by
GitHub
Jun 10, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38508 from RandomShaper/fix_cleanup_info
Fix potential crash when listing leaked objects
parents
cb3ca99b
4e4b1d75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
object.cpp
core/object.cpp
+11
-4
No files found.
core/object.cpp
View file @
ffbea8aa
...
...
@@ -2040,20 +2040,27 @@ void ObjectDB::cleanup() {
WARN_PRINT
(
"ObjectDB instances leaked at exit (run with --verbose for details)."
);
if
(
OS
::
get_singleton
()
->
is_stdout_verbose
())
{
// Ensure calling the native classes because if a leaked instance has a script
// that overrides any of those methods, it'd not be OK to call them at this point,
// now the scripting languages have already been terminated.
MethodBind
*
node_get_name
=
ClassDB
::
get_method
(
"Node"
,
"get_name"
);
MethodBind
*
resource_get_path
=
ClassDB
::
get_method
(
"Resource"
,
"get_path"
);
Callable
::
CallError
call_error
;
for
(
uint32_t
i
=
0
;
i
<
slot_count
;
i
++
)
{
uint32_t
slot
=
object_slots
[
i
].
next_free
;
Object
*
obj
=
object_slots
[
slot
].
object
;
String
node_name
;
String
extra_info
;
if
(
obj
->
is_class
(
"Node"
))
{
node_name
=
" - Node name: "
+
String
(
obj
->
call
(
"get_name"
));
extra_info
=
" - Node name: "
+
String
(
node_get_name
->
call
(
obj
,
nullptr
,
0
,
call_error
));
}
if
(
obj
->
is_class
(
"Resource"
))
{
node_name
=
" - Resource path: "
+
String
(
obj
->
call
(
"get_path"
));
extra_info
=
" - Resource path: "
+
String
(
resource_get_path
->
call
(
obj
,
nullptr
,
0
,
call_error
));
}
uint64_t
id
=
uint64_t
(
slot
)
|
(
uint64_t
(
object_slots
[
slot
].
validator
)
<<
OBJECTDB_VALIDATOR_BITS
)
|
(
object_slots
[
slot
].
is_reference
?
OBJECTDB_REFERENCE_BIT
:
0
);
print_line
(
"Leaked instance: "
+
String
(
obj
->
get_class
())
+
":"
+
itos
(
id
)
+
node_name
);
print_line
(
"Leaked instance: "
+
String
(
obj
->
get_class
())
+
":"
+
itos
(
id
)
+
extra_info
);
}
print_line
(
"Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`)."
);
}
...
...
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