Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
528e9be1
Commit
528e9be1
authored
Sep 19, 2009
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Releasing VLCInstance at exit (thus solving a big memory leak)
Cleaned code.
parent
9ca5a010
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
28 deletions
+11
-28
src/GUI/MainWindow.cpp
src/GUI/MainWindow.cpp
+1
-1
src/LibVLCpp/VLCInstance.cpp
src/LibVLCpp/VLCInstance.cpp
+3
-6
src/LibVLCpp/VLCInstance.h
src/LibVLCpp/VLCInstance.h
+6
-21
src/LibVLCpp/VLCpp.hpp
src/LibVLCpp/VLCpp.hpp
+1
-0
No files found.
src/GUI/MainWindow.cpp
View file @
528e9be1
...
...
@@ -79,7 +79,7 @@ MainWindow::~MainWindow()
if
(
m_renderer
)
delete
m_renderer
;
MetaDataManager
::
destroyInstance
();
LibVLCpp
::
Instance
::
kill
();
LibVLCpp
::
Instance
::
destroyInstance
();
}
void
MainWindow
::
changeEvent
(
QEvent
*
e
)
...
...
src/LibVLCpp/VLCInstance.cpp
View file @
528e9be1
...
...
@@ -26,13 +26,11 @@
using
namespace
LibVLCpp
;
Instance
*
Instance
::
m_singleton
=
NULL
;
Instance
::
Instance
()
{
char
const
*
argv
[]
=
{
//
"-vvvvv",
"-vvvvv"
,
"--no-skip-frames"
,
// "--intf", "dummy",
"--text-renderer"
,
"dummy"
,
...
...
@@ -47,8 +45,7 @@ Instance::Instance()
CheckVlcppException
(
m_ex
);
}
Instance
::
Instance
(
int
argc
,
const
char
**
argv
)
Instance
::
~
Instance
()
{
m_internalPtr
=
libvlc_new
(
argc
,
argv
,
m_ex
);
CheckVlcppException
(
m_ex
);
libvlc_release
(
m_internalPtr
);
}
src/LibVLCpp/VLCInstance.h
View file @
528e9be1
...
...
@@ -26,37 +26,22 @@
#include "vlc/vlc.h"
#include "VLCpp.hpp"
#include "VLCException.h"
#include "Singleton.hpp"
namespace
LibVLCpp
{
class
Instance
:
public
Internal
<
libvlc_instance_t
>
class
Instance
:
public
Internal
<
libvlc_instance_t
>
,
public
Singleton
<
Instance
>
{
private:
Instance
();
Instance
(
int
argc
,
const
char
**
argv
);
~
Instance
();
private:
Exception
m_ex
;
static
Instance
*
m_singleton
;
public:
static
Instance
*
getInstance
()
{
if
(
NULL
==
m_singleton
)
m_singleton
=
new
Instance
();
return
m_singleton
;
}
static
void
kill
()
{
if
(
m_singleton
!=
NULL
)
{
delete
m_singleton
;
m_singleton
=
NULL
;
}
}
friend
class
Singleton
<
Instance
>
;
};
}
...
...
src/LibVLCpp/VLCpp.hpp
View file @
528e9be1
...
...
@@ -41,6 +41,7 @@ namespace LibVLCpp
operator
T
*
()
{
return
m_internalPtr
;
}
protected:
Internal
()
:
m_internalPtr
(
NULL
)
{}
~
Internal
(){}
T
*
m_internalPtr
;
};
...
...
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