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
f7dad789
Unverified
Commit
f7dad789
authored
Jul 02, 2019
by
Bojidar Marinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix various memory leaks and errors
parent
4cb08876
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
17 deletions
+33
-17
rasterizer_scene_gles3.cpp
drivers/gles3/rasterizer_scene_gles3.cpp
+14
-0
gdnative.cpp
modules/gdnative/gdnative.cpp
+7
-11
gdnative.h
modules/gdnative/gdnative.h
+1
-1
context_gl_x11.cpp
platform/x11/context_gl_x11.cpp
+2
-0
particles_2d.cpp
scene/2d/particles_2d.cpp
+1
-0
gi_probe.cpp
scene/3d/gi_probe.cpp
+1
-0
particles.cpp
scene/3d/particles.cpp
+1
-0
soft_body.cpp
scene/3d/soft_body.cpp
+1
-0
skeleton_ik.cpp
scene/animation/skeleton_ik.cpp
+1
-2
scene_tree.cpp
scene/main/scene_tree.cpp
+2
-3
visual_server_raster.cpp
servers/visual/visual_server_raster.cpp
+2
-0
No files found.
drivers/gles3/rasterizer_scene_gles3.cpp
View file @
f7dad789
...
@@ -4990,6 +4990,20 @@ bool RasterizerSceneGLES3::free(RID p_rid) {
...
@@ -4990,6 +4990,20 @@ bool RasterizerSceneGLES3::free(RID p_rid) {
reflection_probe_instance_owner
.
free
(
p_rid
);
reflection_probe_instance_owner
.
free
(
p_rid
);
memdelete
(
reflection_instance
);
memdelete
(
reflection_instance
);
}
else
if
(
environment_owner
.
owns
(
p_rid
))
{
Environment
*
environment
=
environment_owner
.
get
(
p_rid
);
environment_owner
.
free
(
p_rid
);
memdelete
(
environment
);
}
else
if
(
gi_probe_instance_owner
.
owns
(
p_rid
))
{
GIProbeInstance
*
gi_probe_instance
=
gi_probe_instance_owner
.
get
(
p_rid
);
gi_probe_instance_owner
.
free
(
p_rid
);
memdelete
(
gi_probe_instance
);
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
...
modules/gdnative/gdnative.cpp
View file @
f7dad789
...
@@ -48,7 +48,7 @@ static const bool default_reloadable = true;
...
@@ -48,7 +48,7 @@ static const bool default_reloadable = true;
// Defined in gdnative_api_struct.gen.cpp
// Defined in gdnative_api_struct.gen.cpp
extern
const
godot_gdnative_core_api_struct
api_struct
;
extern
const
godot_gdnative_core_api_struct
api_struct
;
Map
<
String
,
Vector
<
Ref
<
GDNative
>
>
>
*
GDNativeLibrary
::
loaded_libraries
=
NULL
;
Map
<
String
,
Vector
<
Ref
<
GDNative
>
>
>
GDNativeLibrary
::
loaded_libraries
;
GDNativeLibrary
::
GDNativeLibrary
()
{
GDNativeLibrary
::
GDNativeLibrary
()
{
config_file
.
instance
();
config_file
.
instance
();
...
@@ -57,10 +57,6 @@ GDNativeLibrary::GDNativeLibrary() {
...
@@ -57,10 +57,6 @@ GDNativeLibrary::GDNativeLibrary() {
load_once
=
default_load_once
;
load_once
=
default_load_once
;
singleton
=
default_singleton
;
singleton
=
default_singleton
;
reloadable
=
default_reloadable
;
reloadable
=
default_reloadable
;
if
(
GDNativeLibrary
::
loaded_libraries
==
NULL
)
{
GDNativeLibrary
::
loaded_libraries
=
memnew
((
Map
<
String
,
Vector
<
Ref
<
GDNative
>
>
>
));
}
}
}
GDNativeLibrary
::~
GDNativeLibrary
()
{
GDNativeLibrary
::~
GDNativeLibrary
()
{
...
@@ -318,10 +314,10 @@ bool GDNative::initialize() {
...
@@ -318,10 +314,10 @@ bool GDNative::initialize() {
#endif
#endif
if
(
library
->
should_load_once
())
{
if
(
library
->
should_load_once
())
{
if
(
GDNativeLibrary
::
loaded_libraries
->
has
(
lib_path
))
{
if
(
GDNativeLibrary
::
loaded_libraries
.
has
(
lib_path
))
{
// already loaded. Don't load again.
// already loaded. Don't load again.
// copy some of the stuff instead
// copy some of the stuff instead
this
->
native_handle
=
(
*
GDNativeLibrary
::
loaded_libraries
)
[
lib_path
][
0
]
->
native_handle
;
this
->
native_handle
=
GDNativeLibrary
::
loaded_libraries
[
lib_path
][
0
]
->
native_handle
;
initialized
=
true
;
initialized
=
true
;
return
true
;
return
true
;
}
}
...
@@ -377,11 +373,11 @@ bool GDNative::initialize() {
...
@@ -377,11 +373,11 @@ bool GDNative::initialize() {
initialized
=
true
;
initialized
=
true
;
if
(
library
->
should_load_once
()
&&
!
GDNativeLibrary
::
loaded_libraries
->
has
(
lib_path
))
{
if
(
library
->
should_load_once
()
&&
!
GDNativeLibrary
::
loaded_libraries
.
has
(
lib_path
))
{
Vector
<
Ref
<
GDNative
>
>
gdnatives
;
Vector
<
Ref
<
GDNative
>
>
gdnatives
;
gdnatives
.
resize
(
1
);
gdnatives
.
resize
(
1
);
gdnatives
.
write
[
0
]
=
Ref
<
GDNative
>
(
this
);
gdnatives
.
write
[
0
]
=
Ref
<
GDNative
>
(
this
);
GDNativeLibrary
::
loaded_libraries
->
insert
(
lib_path
,
gdnatives
);
GDNativeLibrary
::
loaded_libraries
.
insert
(
lib_path
,
gdnatives
);
}
}
return
true
;
return
true
;
...
@@ -395,7 +391,7 @@ bool GDNative::terminate() {
...
@@ -395,7 +391,7 @@ bool GDNative::terminate() {
}
}
if
(
library
->
should_load_once
())
{
if
(
library
->
should_load_once
())
{
Vector
<
Ref
<
GDNative
>
>
*
gdnatives
=
&
(
*
GDNativeLibrary
::
loaded_libraries
)
[
library
->
get_current_library_path
()];
Vector
<
Ref
<
GDNative
>
>
*
gdnatives
=
&
GDNativeLibrary
::
loaded_libraries
[
library
->
get_current_library_path
()];
if
(
gdnatives
->
size
()
>
1
)
{
if
(
gdnatives
->
size
()
>
1
)
{
// there are other GDNative's still using this library, so we actually don't terminate
// there are other GDNative's still using this library, so we actually don't terminate
gdnatives
->
erase
(
Ref
<
GDNative
>
(
this
));
gdnatives
->
erase
(
Ref
<
GDNative
>
(
this
));
...
@@ -405,7 +401,7 @@ bool GDNative::terminate() {
...
@@ -405,7 +401,7 @@ bool GDNative::terminate() {
// we're the last one, terminate!
// we're the last one, terminate!
gdnatives
->
clear
();
gdnatives
->
clear
();
// whew this looks scary, but all it does is remove the entry completely
// whew this looks scary, but all it does is remove the entry completely
GDNativeLibrary
::
loaded_libraries
->
erase
(
GDNativeLibrary
::
loaded_libraries
->
find
(
library
->
get_current_library_path
()));
GDNativeLibrary
::
loaded_libraries
.
erase
(
GDNativeLibrary
::
loaded_libraries
.
find
(
library
->
get_current_library_path
()));
}
}
}
}
...
...
modules/gdnative/gdnative.h
View file @
f7dad789
...
@@ -47,7 +47,7 @@ class GDNative;
...
@@ -47,7 +47,7 @@ class GDNative;
class
GDNativeLibrary
:
public
Resource
{
class
GDNativeLibrary
:
public
Resource
{
GDCLASS
(
GDNativeLibrary
,
Resource
);
GDCLASS
(
GDNativeLibrary
,
Resource
);
static
Map
<
String
,
Vector
<
Ref
<
GDNative
>
>
>
*
loaded_libraries
;
static
Map
<
String
,
Vector
<
Ref
<
GDNative
>
>
>
loaded_libraries
;
friend
class
GDNativeLibraryResourceLoader
;
friend
class
GDNativeLibraryResourceLoader
;
friend
class
GDNative
;
friend
class
GDNative
;
...
...
platform/x11/context_gl_x11.cpp
View file @
f7dad789
...
@@ -145,6 +145,7 @@ Error ContextGL_X11::initialize() {
...
@@ -145,6 +145,7 @@ Error ContextGL_X11::initialize() {
break
;
break
;
}
}
}
}
XFree
(
fbc
);
ERR_FAIL_COND_V
(
!
fbconfig
,
ERR_UNCONFIGURED
);
ERR_FAIL_COND_V
(
!
fbconfig
,
ERR_UNCONFIGURED
);
swa
.
background_pixmap
=
None
;
swa
.
background_pixmap
=
None
;
...
@@ -159,6 +160,7 @@ Error ContextGL_X11::initialize() {
...
@@ -159,6 +160,7 @@ Error ContextGL_X11::initialize() {
vi
=
glXGetVisualFromFBConfig
(
x11_display
,
fbc
[
0
]);
vi
=
glXGetVisualFromFBConfig
(
x11_display
,
fbc
[
0
]);
fbconfig
=
fbc
[
0
];
fbconfig
=
fbc
[
0
];
XFree
(
fbc
);
}
}
int
(
*
oldHandler
)(
Display
*
,
XErrorEvent
*
)
=
XSetErrorHandler
(
&
ctxErrorHandler
);
int
(
*
oldHandler
)(
Display
*
,
XErrorEvent
*
)
=
XSetErrorHandler
(
&
ctxErrorHandler
);
...
...
scene/2d/particles_2d.cpp
View file @
f7dad789
...
@@ -410,6 +410,7 @@ Particles2D::Particles2D() {
...
@@ -410,6 +410,7 @@ Particles2D::Particles2D() {
particles
=
VS
::
get_singleton
()
->
particles_create
();
particles
=
VS
::
get_singleton
()
->
particles_create
();
one_shot
=
false
;
// Needed so that set_emitting doesn't access uninitialized values
set_emitting
(
true
);
set_emitting
(
true
);
set_one_shot
(
false
);
set_one_shot
(
false
);
set_amount
(
8
);
set_amount
(
8
);
...
...
scene/3d/gi_probe.cpp
View file @
f7dad789
...
@@ -571,4 +571,5 @@ GIProbe::GIProbe() {
...
@@ -571,4 +571,5 @@ GIProbe::GIProbe() {
}
}
GIProbe
::~
GIProbe
()
{
GIProbe
::~
GIProbe
()
{
VS
::
get_singleton
()
->
free
(
gi_probe
);
}
}
scene/3d/particles.cpp
View file @
f7dad789
...
@@ -411,6 +411,7 @@ Particles::Particles() {
...
@@ -411,6 +411,7 @@ Particles::Particles() {
particles
=
VS
::
get_singleton
()
->
particles_create
();
particles
=
VS
::
get_singleton
()
->
particles_create
();
set_base
(
particles
);
set_base
(
particles
);
one_shot
=
false
;
// Needed so that set_emitting doesn't access uninitialized values
set_emitting
(
true
);
set_emitting
(
true
);
set_one_shot
(
false
);
set_one_shot
(
false
);
set_amount
(
8
);
set_amount
(
8
);
...
...
scene/3d/soft_body.cpp
View file @
f7dad789
...
@@ -712,6 +712,7 @@ SoftBody::SoftBody() :
...
@@ -712,6 +712,7 @@ SoftBody::SoftBody() :
}
}
SoftBody
::~
SoftBody
()
{
SoftBody
::~
SoftBody
()
{
PhysicsServer
::
get_singleton
()
->
free
(
physics_rid
);
}
}
void
SoftBody
::
reset_softbody_pin
()
{
void
SoftBody
::
reset_softbody_pin
()
{
...
...
scene/animation/skeleton_ik.cpp
View file @
f7dad789
...
@@ -406,6 +406,7 @@ void SkeletonIK::_notification(int p_what) {
...
@@ -406,6 +406,7 @@ void SkeletonIK::_notification(int p_what) {
switch
(
p_what
)
{
switch
(
p_what
)
{
case
NOTIFICATION_ENTER_TREE
:
{
case
NOTIFICATION_ENTER_TREE
:
{
skeleton
=
Object
::
cast_to
<
Skeleton
>
(
get_parent
());
skeleton
=
Object
::
cast_to
<
Skeleton
>
(
get_parent
());
set_process_priority
(
1
);
reload_chain
();
reload_chain
();
}
break
;
}
break
;
case
NOTIFICATION_INTERNAL_PROCESS
:
{
case
NOTIFICATION_INTERNAL_PROCESS
:
{
...
@@ -431,8 +432,6 @@ SkeletonIK::SkeletonIK() :
...
@@ -431,8 +432,6 @@ SkeletonIK::SkeletonIK() :
skeleton
(
NULL
),
skeleton
(
NULL
),
target_node_override
(
NULL
),
target_node_override
(
NULL
),
task
(
NULL
)
{
task
(
NULL
)
{
set_process_priority
(
1
);
}
}
SkeletonIK
::~
SkeletonIK
()
{
SkeletonIK
::~
SkeletonIK
()
{
...
...
scene/main/scene_tree.cpp
View file @
f7dad789
...
@@ -453,9 +453,6 @@ void SceneTree::init() {
...
@@ -453,9 +453,6 @@ void SceneTree::init() {
//_quit=false;
//_quit=false;
initialized
=
true
;
initialized
=
true
;
input_handled
=
false
;
pause
=
false
;
root
->
_set_tree
(
this
);
root
->
_set_tree
(
this
);
MainLoop
::
init
();
MainLoop
::
init
();
...
@@ -1986,6 +1983,8 @@ SceneTree::SceneTree() {
...
@@ -1986,6 +1983,8 @@ SceneTree::SceneTree() {
idle_process_time
=
1
;
idle_process_time
=
1
;
root
=
NULL
;
root
=
NULL
;
input_handled
=
false
;
pause
=
false
;
current_frame
=
0
;
current_frame
=
0
;
current_event
=
0
;
current_event
=
0
;
tree_changed_name
=
"tree_changed"
;
tree_changed_name
=
"tree_changed"
;
...
...
servers/visual/visual_server_raster.cpp
View file @
f7dad789
...
@@ -77,6 +77,8 @@ void VisualServerRaster::free(RID p_rid) {
...
@@ -77,6 +77,8 @@ void VisualServerRaster::free(RID p_rid) {
return
;
return
;
if
(
VSG
::
scene
->
free
(
p_rid
))
if
(
VSG
::
scene
->
free
(
p_rid
))
return
;
return
;
if
(
VSG
::
scene_render
->
free
(
p_rid
))
return
;
}
}
/* EVENT QUEUING */
/* EVENT QUEUING */
...
...
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