Use the new single-instance="true" attribute in avmedia

Change-Id: If3f882b4f28224d951492c26800d3009b8cb04b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103858
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2020-10-02 14:29:23 +02:00
parent d777da0551
commit c1152bceb7
2 changed files with 3 additions and 4 deletions

View file

@ -10,7 +10,7 @@
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.media.Manager_VLC"
constructor="com_sun_star_comp_media_Manager_VLC_get_implementation">
constructor="com_sun_star_comp_media_Manager_VLC_get_implementation" single-instance="true">
<service name="com.sun.star.comp.avmedia.Manager_VLC"/>
</implementation>
</component>

View file

@ -11,6 +11,7 @@
#include <boost/lexical_cast.hpp>
#include <com/sun/star/uno/Exception.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
#include <sal/log.hxx>
#include "vlcmanager.hxx"
#include "vlcplayer.hxx"
@ -127,9 +128,7 @@ com_sun_star_comp_media_Manager_VLC_get_implementation(
// Experimental for now - code is neither elegant nor well tested.
if (!officecfg::Office::Common::Misc::ExperimentalMode::get(context))
return nullptr;
static uno::Reference< uno::XInterface > manager( *new ::avmedia::vlc::Manager );
manager->acquire();
return manager.get();
return cppu::acquire(static_cast<cppu::OWeakObject *>(new ::avmedia::vlc::Manager));
}