[Libreoffice-commits] core.git: 5 commits - filter/source unoxml/source vcl/inc vcl/win
Michael Stahl
mstahl at redhat.com
Thu Mar 24 22:12:28 UTC 2016
filter/source/pdf/pdfexport.cxx | 2 +-
unoxml/source/rdf/CBlankNode.cxx | 7 ++++---
unoxml/source/rdf/CLiteral.cxx | 7 ++++---
unoxml/source/rdf/CURI.cxx | 7 ++++---
unoxml/source/rdf/librdf_repository.cxx | 25 ++++++++++++++++---------
vcl/inc/win/salgdi.h | 2 ++
vcl/win/gdi/salfont.cxx | 14 +++++++++++++-
vcl/win/gdi/winlayout.cxx | 6 ++++++
8 files changed, 50 insertions(+), 20 deletions(-)
New commits:
commit 62ab87f70b22b70b162b50973072565066f707cf
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Mar 24 22:36:52 2016 +0100
vcl: let's try to convert that to an assert
Change-Id: I41867f0d18e604ffb67a37ba3ab3a08a59749c13
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 0485eaf..48a3c92 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1453,7 +1453,7 @@ sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel
return 0;
}
- DBG_ASSERT( pFont->mpFontData, "WinSalGraphics mpFontData==NULL");
+ assert(pFont->mpFontData);
if (mpWinFontEntry[nFallbackLevel])
{
GetWinFontEntry(nFallbackLevel)->mpFontCache->Release(GetWinFontEntry(nFallbackLevel));
commit 99207a26df0083851ba8e23be72d5c6974f98a3b
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Mar 24 22:20:06 2016 +0100
vcl: tdf#98812: acquire reference count of WinFontInstances
... when they are inserted in WinSalGraphics::mpWinFontEntry.
Not sure why one of these drops to 0 but is not removed from the
WinSalGraphics when formatting this particular bugdoc.
Acquiring the instances when retaining pointers to them should make
the life cycle a little less insane.
Change-Id: If1404f46a13736b2a226e198bdf0c3ca8e09bb38
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index a889b45..ffd83ab 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -219,6 +219,8 @@ private:
sal_uIntPtr mnFontKernPairCount;// Number of Kerning Pairs of the current Font
int mnPenWidth; // Linienbreite
+ LogicalFontInstance* GetWinFontEntry(int nFallbackLevel);
+
public:
HDC getHDC() const { return mhLocalDC; }
void setHDC(HDC aNew) { mhLocalDC = aNew; }
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 3278e88..0485eaf 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -1442,12 +1442,23 @@ sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel
if( mhFonts[i] )
::DeleteFont( mhFonts[i] );
mhFonts[ i ] = 0;
+ if (mpWinFontEntry[i])
+ {
+ GetWinFontEntry(i)->mpFontCache->Release(GetWinFontEntry(i));
+ }
+ mpWinFontEntry[i] = nullptr;
+ mpWinFontData[i] = nullptr;
}
mhDefFont = 0;
return 0;
}
DBG_ASSERT( pFont->mpFontData, "WinSalGraphics mpFontData==NULL");
+ if (mpWinFontEntry[nFallbackLevel])
+ {
+ GetWinFontEntry(nFallbackLevel)->mpFontCache->Release(GetWinFontEntry(nFallbackLevel));
+ }
+ pFont->mpFontInstance->mpFontCache->Acquire(pFont->mpFontInstance);
mpWinFontEntry[ nFallbackLevel ] = reinterpret_cast<WinFontInstance*>( pFont->mpFontInstance );
mpWinFontData[ nFallbackLevel ] = static_cast<const WinFontFace*>( pFont->mpFontData );
@@ -1470,6 +1481,7 @@ sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel
::DeleteFont( mhFonts[i] );
mhFonts[i] = 0;
}
+ // note: removing mpWinFontEntry[i] here has obviously bad effects
}
}
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index e073a01..65ebbdd 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -1362,6 +1362,7 @@ WinLayout::WinLayout(HDC hDC, const WinFontFace& rWFD, WinFontInstance& rWFE, bo
mrWinFontData( rWFD ),
mrWinFontEntry(rWFE)
{
+ assert(mrWinFontEntry.mnRefCount > 0);
// keep mrWinFontEntry alive
mrWinFontEntry.mpFontCache->Acquire(&mrWinFontEntry);
}
@@ -4288,6 +4289,11 @@ int WinSalGraphics::GetMinKashidaWidth()
return nMinKashida;
}
+LogicalFontInstance * WinSalGraphics::GetWinFontEntry(int const nFallbackLevel)
+{
+ return mpWinFontEntry[nFallbackLevel];
+}
+
WinFontInstance::WinFontInstance( FontSelectPattern& rFSD )
: LogicalFontInstance( rFSD )
, mpKerningPairs( NULL )
commit 1cd0a3153db52e454818b4996a288997d60ae053
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Mar 24 22:53:27 2016 +0100
unordf: replace boost::shared_array with std::shared_ptr
It was using a custom deleter anyway.
Change-Id: I700b7cf314b7f837a7143206ba42e412c5a1670d
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 3b3a180..149b6f6 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -28,7 +28,6 @@
#include <functional>
#include <algorithm>
-#include <boost/shared_array.hpp>
#include <boost/optional.hpp>
#include <libxslt/security.h>
@@ -645,10 +644,10 @@ throw (uno::RuntimeException, container::NoSuchElementException,
if (!librdf_query_results_finished(m_pQueryResult.get())) {
sal_Int32 count(m_BindingNames.getLength());
OSL_ENSURE(count >= 0, "negative length?");
- boost::shared_array<librdf_node*> pNodes( new librdf_node*[count],
+ std::shared_ptr<librdf_node*> const pNodes(new librdf_node*[count],
NodeArrayDeleter(count));
for (int i = 0; i < count; ++i) {
- pNodes[i] = nullptr;
+ pNodes.get()[i] = nullptr;
}
if (librdf_query_results_get_bindings(m_pQueryResult.get(), nullptr,
pNodes.get()))
@@ -663,7 +662,7 @@ throw (uno::RuntimeException, container::NoSuchElementException,
}
uno::Sequence< uno::Reference< rdf::XNode > > ret(count);
for (int i = 0; i < count; ++i) {
- ret[i] = m_xRep->getTypeConverter().convertToXNode(pNodes[i]);
+ ret[i] = m_xRep->getTypeConverter().convertToXNode(pNodes.get()[i]);
}
// NB: this will invalidate current item.
librdf_query_results_next(m_pQueryResult.get());
commit 9cdfc240324679b1214ee175a3ed233f4cf4ecef
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Mar 24 22:47:56 2016 +0100
unordf: replace boost::noncopyable with C++11 delete
Change-Id: I996ca0589db8b73db045c87bbecfab03be9dbaef
diff --git a/unoxml/source/rdf/CBlankNode.cxx b/unoxml/source/rdf/CBlankNode.cxx
index 0a79cf1..5db736e 100644
--- a/unoxml/source/rdf/CBlankNode.cxx
+++ b/unoxml/source/rdf/CBlankNode.cxx
@@ -19,7 +19,6 @@
#include "CNodes.hxx"
-#include <boost/noncopyable.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -36,8 +35,7 @@ class CBlankNode:
public ::cppu::WeakImplHelper<
css::lang::XServiceInfo,
css::lang::XInitialization,
- css::rdf::XBlankNode>,
- private boost::noncopyable
+ css::rdf::XBlankNode>
{
public:
CBlankNode();
@@ -55,6 +53,9 @@ public:
virtual OUString SAL_CALL getStringValue() throw (css::uno::RuntimeException, std::exception) override;
private:
+ CBlankNode(CBlankNode const&) = delete;
+ CBlankNode& operator=(CBlankNode const&) = delete;
+
OUString m_NodeID;
};
diff --git a/unoxml/source/rdf/CLiteral.cxx b/unoxml/source/rdf/CLiteral.cxx
index 15026c7..a46a4a6 100644
--- a/unoxml/source/rdf/CLiteral.cxx
+++ b/unoxml/source/rdf/CLiteral.cxx
@@ -19,7 +19,6 @@
#include "CNodes.hxx"
-#include <boost/noncopyable.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -38,8 +37,7 @@ class CLiteral:
public ::cppu::WeakImplHelper<
css::lang::XServiceInfo,
css::lang::XInitialization,
- css::rdf::XLiteral>,
- private boost::noncopyable
+ css::rdf::XLiteral>
{
public:
explicit CLiteral();
@@ -62,6 +60,9 @@ public:
virtual css::uno::Reference< css::rdf::XURI > SAL_CALL getDatatype() throw (css::uno::RuntimeException, std::exception) override;
private:
+ CLiteral(CLiteral const&) = delete;
+ CLiteral& operator=(CLiteral const&) = delete;
+
OUString m_Value;
OUString m_Language;
css::uno::Reference< css::rdf::XURI > m_xDatatype;
diff --git a/unoxml/source/rdf/CURI.cxx b/unoxml/source/rdf/CURI.cxx
index eef6245..64f31dd 100644
--- a/unoxml/source/rdf/CURI.cxx
+++ b/unoxml/source/rdf/CURI.cxx
@@ -19,7 +19,6 @@
#include "CNodes.hxx"
-#include <boost/noncopyable.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -37,8 +36,7 @@ class CURI:
public ::cppu::WeakImplHelper<
css::lang::XServiceInfo,
css::lang::XInitialization,
- css::rdf::XURI>,
- private boost::noncopyable
+ css::rdf::XURI>
{
public:
explicit CURI();
@@ -60,6 +58,9 @@ public:
virtual OUString SAL_CALL getNamespace() throw (css::uno::RuntimeException, std::exception) override;
private:
+ CURI(CURI const&) = delete;
+ CURI& operator=(CURI const&) = delete;
+
/// handle css.rdf.URIs
void SAL_CALL initFromConstant(const sal_Int16 i_Constant);
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 04e0f7f..3b3a180 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -28,7 +28,6 @@
#include <functional>
#include <algorithm>
-#include <boost/noncopyable.hpp>
#include <boost/shared_array.hpp>
#include <boost/optional.hpp>
@@ -261,7 +260,6 @@ private:
/** implements the repository service.
*/
class librdf_Repository:
- private boost::noncopyable,
// private ::cppu::BaseMutex,
public ::cppu::WeakImplHelper<
lang::XServiceInfo,
@@ -402,6 +400,9 @@ public:
private:
+ librdf_Repository(librdf_Repository const&) = delete;
+ librdf_Repository& operator=(librdf_Repository const&) = delete;
+
/// this is const, no need to lock m_aMutex to access it
uno::Reference< uno::XComponentContext > const m_xContext;
@@ -443,7 +444,6 @@ private:
an XEnumeration of statements.
*/
class librdf_GraphResult:
- private boost::noncopyable,
public ::cppu::WeakImplHelper<
container::XEnumeration>
{
@@ -478,6 +478,10 @@ public:
lang::WrappedTargetException, std::exception) override;
private:
+
+ librdf_GraphResult(librdf_GraphResult const&) = delete;
+ librdf_GraphResult& operator=(librdf_GraphResult const&) = delete;
+
// NB: this is not a weak pointer: streams _must_ be deleted before the
// storage they point into, so we keep the repository alive here
// also, sequence is important: the stream must be destroyed first.
@@ -555,7 +559,6 @@ throw (uno::RuntimeException, container::NoSuchElementException,
/** result of tuple queries ("SELECT").
*/
class librdf_QuerySelectResult:
- private boost::noncopyable,
public ::cppu::WeakImplHelper<
rdf::XQuerySelectResult>
{
@@ -594,6 +597,9 @@ public:
private:
+ librdf_QuerySelectResult(librdf_QuerySelectResult const&) = delete;
+ librdf_QuerySelectResult& operator=(librdf_QuerySelectResult const&) = delete;
+
// NB: this is not a weak pointer: streams _must_ be deleted before the
// storage they point into, so we keep the repository alive here
// also, sequence is important: the stream must be destroyed first.
@@ -679,7 +685,6 @@ librdf_QuerySelectResult::getBindingNames() throw (uno::RuntimeException, std::e
/** represents a named graph, and forwards all the work to repository.
*/
class librdf_NamedGraph:
- private boost::noncopyable,
public ::cppu::WeakImplHelper<
rdf::XNamedGraph>
{
@@ -730,6 +735,9 @@ public:
private:
+ librdf_NamedGraph(librdf_NamedGraph const&) = delete;
+ librdf_NamedGraph& operator=(librdf_NamedGraph const&) = delete;
+
/// weak reference: this is needed to check if m_pRep is valid
uno::WeakReference< rdf::XRepository > const m_wRep;
librdf_Repository *const m_pRep;
commit a764d03e0cf34bb11f82fbb44850feda312ce24b
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Mar 24 22:12:00 2016 +0100
filter: [loplugin:simplifybool]
Change-Id: I491708d12c0c220705fe79a16ca85cf874692b77
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 892f146..0f5ce3e 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -883,7 +883,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
if ( ! ( aSelection >>= xShapes ) )
bExportNotesPages = true;
}
- const bool bExportPages = bExportNotesPages ? !mbExportOnlyNotesPages : true;
+ const bool bExportPages = !bExportNotesPages || !mbExportOnlyNotesPages;
if( aPageRange.isEmpty() )
{
More information about the Libreoffice-commits
mailing list