Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
3b684d30
Commit
3b684d30
authored
11 years ago
by
sapier
Committed by
kwolekr
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix 3d model mesh leak
parent
e1146396
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/client.cpp
+23
-2
23 additions, 2 deletions
src/client.cpp
with
23 additions
and
2 deletions
src/client.cpp
+
23
−
2
View file @
3b684d30
...
...
@@ -363,6 +363,15 @@ Client::~Client()
for
(
std
::
list
<
MediaFetchThread
*>::
iterator
i
=
m_media_fetch_threads
.
begin
();
i
!=
m_media_fetch_threads
.
end
();
++
i
)
delete
*
i
;
// cleanup 3d model meshes on client shutdown
while
(
m_device
->
getSceneManager
()
->
getMeshCache
()
->
getMeshCount
()
!=
0
)
{
scene
::
IAnimatedMesh
*
mesh
=
m_device
->
getSceneManager
()
->
getMeshCache
()
->
getMeshByIndex
(
0
);
if
(
mesh
!=
NULL
)
m_device
->
getSceneManager
()
->
getMeshCache
()
->
removeMesh
(
mesh
);
}
}
void
Client
::
connect
(
Address
address
)
...
...
@@ -976,14 +985,26 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
{
verbosestream
<<
"Client: Storing model into Irrlicht: "
<<
"
\"
"
<<
filename
<<
"
\"
"
<<
std
::
endl
;
scene
::
ISceneManager
*
smgr
=
m_device
->
getSceneManager
();
//check if mesh was already cached
scene
::
IAnimatedMesh
*
mesh
=
smgr
->
getMeshCache
()
->
getMeshByName
(
filename
.
c_str
());
if
(
mesh
!=
NULL
)
{
errorstream
<<
"Multiple models with name: "
<<
filename
.
c_str
()
<<
" found replacing previous model!"
<<
std
::
endl
;
smgr
->
getMeshCache
()
->
removeMesh
(
mesh
);
mesh
=
0
;
}
io
::
IFileSystem
*
irrfs
=
m_device
->
getFileSystem
();
io
::
IReadFile
*
rfile
=
irrfs
->
createMemoryReadFile
(
*
data_rw
,
data_rw
.
getSize
(),
filename
.
c_str
());
assert
(
rfile
);
scene
::
ISceneManager
*
smgr
=
m_device
->
getSceneManager
();
scene
::
IAnimatedMesh
*
mesh
=
smgr
->
getMesh
(
rfile
);
mesh
=
smgr
->
getMesh
(
rfile
);
smgr
->
getMeshCache
()
->
addMesh
(
filename
.
c_str
(),
mesh
);
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment