Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ef9449cd
Kaydet (Commit)
ef9449cd
authored
Tem 11, 2014
tarafından
Takeshi Abe
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid possible memory leaks in case of exceptions
Change-Id: I5e302cf7ac784e1413c0539d0c967a3523f04ba0
üst
18258eb8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
50 deletions
+22
-50
component_context.cxx
cppuhelper/source/component_context.cxx
+5
-3
interfacecontainer.cxx
cppuhelper/source/interfacecontainer.cxx
+5
-8
propshlp.cxx
cppuhelper/source/propshlp.cxx
+12
-39
No files found.
cppuhelper/source/component_context.cxx
Dosyayı görüntüle @
ef9449cd
...
...
@@ -54,6 +54,8 @@
#include <com/sun/star/uno/DeploymentException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <boost/scoped_array.hpp>
#define SMGR_SINGLETON "/singletons/com.sun.star.lang.theServiceManager"
#define TDMGR_SINGLETON "/singletons/com.sun.star.reflection.theTypeDescriptionManager"
#define AC_SINGLETON "/singletons/com.sun.star.security.theAccessController"
...
...
@@ -844,7 +846,7 @@ Reference< XComponentContext > SAL_CALL createComponentContext(
uno
::
Mapping
curr2source
(
curr_env
,
source_env
);
uno
::
Mapping
source2curr
(
source_env
,
curr_env
);
ContextEntry_Init
*
mapped_entries
=
new
ContextEntry_Init
[
nEntries
]
;
boost
::
scoped_array
<
ContextEntry_Init
>
mapped_entries
(
new
ContextEntry_Init
[
nEntries
])
;
for
(
sal_Int32
nPos
=
0
;
nPos
<
nEntries
;
++
nPos
)
{
mapped_entries
[
nPos
].
bLateInitService
=
pEntries
[
nPos
].
bLateInitService
;
...
...
@@ -858,8 +860,8 @@ Reference< XComponentContext > SAL_CALL createComponentContext(
void
*
mapped_delegate
=
curr2source
.
mapInterface
(
xDelegate
.
get
(),
::
getCppuType
(
&
xDelegate
));
XComponentContext
*
pXComponentContext
=
NULL
;
source_env
.
invoke
(
s_createComponentContext_v
,
mapped_entries
,
nEntries
,
mapped_delegate
,
&
pXComponentContext
,
&
source2curr
);
delete
[]
mapped_entries
;
source_env
.
invoke
(
s_createComponentContext_v
,
mapped_entries
.
get
()
,
nEntries
,
mapped_delegate
,
&
pXComponentContext
,
&
source2curr
);
mapped_entries
.
reset
()
;
return
Reference
<
XComponentContext
>
(
pXComponentContext
,
SAL_NO_ACQUIRE
);
}
...
...
cppuhelper/source/interfacecontainer.cxx
Dosyayı görüntüle @
ef9449cd
...
...
@@ -25,6 +25,7 @@
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <boost/scoped_array.hpp>
#include <boost/unordered_map.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
...
...
@@ -455,7 +456,7 @@ sal_Int32 OMultiTypeInterfaceContainerHelper::removeInterface(
void
OMultiTypeInterfaceContainerHelper
::
disposeAndClear
(
const
EventObject
&
rEvt
)
{
t_type2ptr
::
size_type
nSize
=
0
;
OInterfaceContainerHelper
**
ppListenerContainers
=
NULL
;
boost
::
scoped_array
<
OInterfaceContainerHelper
*>
ppListenerContainers
;
{
::
osl
::
MutexGuard
aGuard
(
rMutex
);
t_type2ptr
*
pMap
=
(
t_type2ptr
*
)
m_pMap
;
...
...
@@ -463,7 +464,7 @@ void OMultiTypeInterfaceContainerHelper::disposeAndClear( const EventObject & rE
if
(
nSize
)
{
typedef
OInterfaceContainerHelper
*
ppp
;
ppListenerContainers
=
new
ppp
[
nSize
]
;
ppListenerContainers
.
reset
(
new
ppp
[
nSize
])
;
//ppListenerContainers = new (ListenerContainer*)[nSize];
t_type2ptr
::
iterator
iter
=
pMap
->
begin
();
...
...
@@ -485,8 +486,6 @@ void OMultiTypeInterfaceContainerHelper::disposeAndClear( const EventObject & rE
if
(
ppListenerContainers
[
i
]
)
ppListenerContainers
[
i
]
->
disposeAndClear
(
rEvt
);
}
delete
[]
ppListenerContainers
;
}
void
OMultiTypeInterfaceContainerHelper
::
clear
()
...
...
@@ -631,7 +630,7 @@ sal_Int32 OMultiTypeInterfaceContainerHelperInt32::removeInterface(
void
OMultiTypeInterfaceContainerHelperInt32
::
disposeAndClear
(
const
EventObject
&
rEvt
)
{
t_long2ptr
::
size_type
nSize
=
0
;
OInterfaceContainerHelper
**
ppListenerContainers
=
NULL
;
boost
::
scoped_array
<
OInterfaceContainerHelper
*>
ppListenerContainers
;
{
::
osl
::
MutexGuard
aGuard
(
rMutex
);
if
(
!
m_pMap
)
...
...
@@ -642,7 +641,7 @@ void OMultiTypeInterfaceContainerHelperInt32::disposeAndClear( const EventObject
if
(
nSize
)
{
typedef
OInterfaceContainerHelper
*
ppp
;
ppListenerContainers
=
new
ppp
[
nSize
]
;
ppListenerContainers
.
reset
(
new
ppp
[
nSize
])
;
t_long2ptr
::
iterator
iter
=
pMap
->
begin
();
t_long2ptr
::
iterator
end
=
pMap
->
end
();
...
...
@@ -663,8 +662,6 @@ void OMultiTypeInterfaceContainerHelperInt32::disposeAndClear( const EventObject
if
(
ppListenerContainers
[
i
]
)
ppListenerContainers
[
i
]
->
disposeAndClear
(
rEvt
);
}
delete
[]
ppListenerContainers
;
}
void
OMultiTypeInterfaceContainerHelperInt32
::
clear
()
...
...
cppuhelper/source/propshlp.cxx
Dosyayı görüntüle @
ef9449cd
...
...
@@ -25,7 +25,7 @@
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <boost/scoped_array.hpp>
using
namespace
osl
;
using
namespace
com
::
sun
::
star
::
uno
;
...
...
@@ -839,16 +839,11 @@ void OPropertySetHelper::setFastPropertyValues(
OSL_ENSURE
(
!
rBHelper
.
bInDispose
,
"do not getFastPropertyValue in the dispose call"
);
OSL_ENSURE
(
!
rBHelper
.
bDisposed
,
"object is disposed"
);
Any
*
pConvertedValues
=
NULL
;
Any
*
pOldValues
=
NULL
;
try
{
// get the map table
IPropertyArrayHelper
&
rPH
=
getInfoHelper
();
pConvertedValues
=
new
Any
[
nHitCount
]
;
pOldValues
=
new
Any
[
nHitCount
]
;
boost
::
scoped_array
<
Any
>
pConvertedValues
(
new
Any
[
nHitCount
])
;
boost
::
scoped_array
<
Any
>
pOldValues
(
new
Any
[
nHitCount
])
;
sal_Int32
n
=
0
;
sal_Int32
i
;
...
...
@@ -878,7 +873,7 @@ void OPropertySetHelper::setFastPropertyValues(
}
// fire vetoable events
fire
(
pHandles
,
pConvertedValues
,
pOldValues
,
n
,
sal_True
);
fire
(
pHandles
,
pConvertedValues
.
get
(),
pOldValues
.
get
()
,
n
,
sal_True
);
{
// must lock the mutex outside the loop.
...
...
@@ -893,16 +888,7 @@ void OPropertySetHelper::setFastPropertyValues(
}
// fire change events
impl_fireAll
(
pHandles
,
pConvertedValues
,
pOldValues
,
n
);
}
catch
(
...
)
{
delete
[]
pOldValues
;
delete
[]
pConvertedValues
;
throw
;
}
delete
[]
pOldValues
;
delete
[]
pConvertedValues
;
impl_fireAll
(
pHandles
,
pConvertedValues
.
get
(),
pOldValues
.
get
(),
n
);
}
// XMultiPropertySet
...
...
@@ -915,24 +901,14 @@ void OPropertySetHelper::setPropertyValues(
const
Sequence
<
Any
>&
rValues
)
throw
(
::
com
::
sun
::
star
::
beans
::
PropertyVetoException
,
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
,
::
com
::
sun
::
star
::
lang
::
WrappedTargetException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
,
std
::
exception
)
{
sal_Int32
*
pHandles
=
NULL
;
try
{
sal_Int32
nSeqLen
=
rPropertyNames
.
getLength
();
pHandles
=
new
sal_Int32
[
nSeqLen
]
;
boost
::
scoped_array
<
sal_Int32
>
pHandles
(
new
sal_Int32
[
nSeqLen
])
;
// get the map table
IPropertyArrayHelper
&
rPH
=
getInfoHelper
();
// fill the handle array
sal_Int32
nHitCount
=
rPH
.
fillHandles
(
pHandles
,
rPropertyNames
);
sal_Int32
nHitCount
=
rPH
.
fillHandles
(
pHandles
.
get
()
,
rPropertyNames
);
if
(
nHitCount
!=
0
)
setFastPropertyValues
(
nSeqLen
,
pHandles
,
rValues
.
getConstArray
(),
nHitCount
);
}
catch
(
...
)
{
delete
[]
pHandles
;
throw
;
}
delete
[]
pHandles
;
setFastPropertyValues
(
nSeqLen
,
pHandles
.
get
(),
rValues
.
getConstArray
(),
nHitCount
);
}
// XMultiPropertySet
...
...
@@ -940,13 +916,13 @@ Sequence<Any> OPropertySetHelper::getPropertyValues( const Sequence<OUString>& r
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
,
std
::
exception
)
{
sal_Int32
nSeqLen
=
rPropertyNames
.
getLength
();
sal_Int32
*
pHandles
=
new
sal_Int32
[
nSeqLen
]
;
boost
::
scoped_array
<
sal_Int32
>
pHandles
(
new
sal_Int32
[
nSeqLen
])
;
Sequence
<
Any
>
aValues
(
nSeqLen
);
// get the map table
IPropertyArrayHelper
&
rPH
=
getInfoHelper
();
// fill the handle array
rPH
.
fillHandles
(
pHandles
,
rPropertyNames
);
rPH
.
fillHandles
(
pHandles
.
get
()
,
rPropertyNames
);
Any
*
pValues
=
aValues
.
getArray
();
...
...
@@ -955,7 +931,6 @@ Sequence<Any> OPropertySetHelper::getPropertyValues( const Sequence<OUString>& r
for
(
sal_Int32
i
=
0
;
i
<
nSeqLen
;
i
++
)
getFastPropertyValue
(
pValues
[
i
],
pHandles
[
i
]
);
delete
[]
pHandles
;
return
aValues
;
}
...
...
@@ -983,9 +958,9 @@ void OPropertySetHelper::firePropertiesChangeEvent(
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
,
std
::
exception
)
{
sal_Int32
nLen
=
rPropertyNames
.
getLength
();
sal_Int32
*
pHandles
=
new
sal_Int32
[
nLen
]
;
boost
::
scoped_array
<
sal_Int32
>
pHandles
(
new
sal_Int32
[
nLen
])
;
IPropertyArrayHelper
&
rPH
=
getInfoHelper
();
rPH
.
fillHandles
(
pHandles
,
rPropertyNames
);
rPH
.
fillHandles
(
pHandles
.
get
()
,
rPropertyNames
);
const
OUString
*
pNames
=
rPropertyNames
.
getConstArray
();
// get the count of matching properties
...
...
@@ -1019,8 +994,6 @@ void OPropertySetHelper::firePropertiesChangeEvent(
}
if
(
nFireLen
)
rListener
->
propertiesChange
(
aChanges
);
delete
[]
pHandles
;
}
void
OPropertySetHelper2
::
enableChangeListenerNotification
(
sal_Bool
bEnable
)
...
...
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