summaryrefslogtreecommitdiff
path: root/canvas/inc
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@novell.com>2011-04-08 16:44:28 +0200
committerThorsten Behrens <tbehrens@novell.com>2011-04-08 16:47:25 +0200
commit09b546cf9c1d0d9f78066e70a0348c7678cdcb14 (patch)
treeea9fb80453a70202a8f8d4bff4710d92259ac5b1 /canvas/inc
parent55961e2dfdac4491aa8a56d86930e5999b7d523b (diff)
Fix overloaded-virtual warning in canvas
With enabled -Woverloaded-virtual gcc warning (see http://lists.freedesktop.org/archives/libreoffice/2011-March/009567.html), canvas exposed a nasty clash between WeakComponentImplHelper::disposing and XEventListener::disposing. Fixed by overriding *once* in baseclass, and then calling disambiguated, renamed methods.
Diffstat (limited to 'canvas/inc')
-rw-r--r--canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx11
-rw-r--r--canvas/inc/canvas/base/canvasbase.hxx7
-rw-r--r--canvas/inc/canvas/base/canvascustomspritebase.hxx4
-rw-r--r--canvas/inc/canvas/base/disambiguationhelper.hxx (renamed from canvas/inc/canvas/base/basemutexhelper.hxx)36
-rw-r--r--canvas/inc/canvas/base/graphicdevicebase.hxx9
-rw-r--r--canvas/inc/canvas/base/spritecanvasbase.hxx7
6 files changed, 41 insertions, 33 deletions
diff --git a/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx b/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx
index 9e31473ba589..9317c8230bc6 100644
--- a/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx
+++ b/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx
@@ -183,10 +183,7 @@ namespace canvas
return ::com::sun::star::uno::makeAny(mxWindow);
}
-#if defined __SUNPRO_CC
- using Base::disposing;
-#endif
- virtual void SAL_CALL disposing()
+ virtual void disposeThis()
{
typename BaseType::MutexType aGuard( BaseType::m_aMutex );
@@ -197,7 +194,7 @@ namespace canvas
}
// pass on to base class
- BaseType::disposing();
+ BaseType::disposeThis();
}
::com::sun::star::awt::Rectangle transformBounds( const ::com::sun::star::awt::Rectangle& rBounds )
@@ -234,12 +231,14 @@ namespace canvas
}
// XWindowListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
+ virtual void SAL_CALL disposeEventSource( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
{
typename BaseType::MutexType aGuard( BaseType::m_aMutex );
if( Source.Source == mxWindow )
mxWindow.clear();
+
+ BaseType::disposeEventSource(Source);
}
virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException)
diff --git a/canvas/inc/canvas/base/canvasbase.hxx b/canvas/inc/canvas/base/canvasbase.hxx
index 204355da93c3..7afcf9f8aea7 100644
--- a/canvas/inc/canvas/base/canvasbase.hxx
+++ b/canvas/inc/canvas/base/canvasbase.hxx
@@ -120,17 +120,14 @@ namespace canvas
{
}
-#if defined __SUNPRO_CC
- using Base::disposing;
-#endif
- virtual void SAL_CALL disposing()
+ virtual void disposeThis()
{
MutexType aGuard( BaseType::m_aMutex );
maCanvasHelper.disposing();
// pass on to base class
- BaseType::disposing();
+ BaseType::disposeThis();
}
// XCanvas
diff --git a/canvas/inc/canvas/base/canvascustomspritebase.hxx b/canvas/inc/canvas/base/canvascustomspritebase.hxx
index ec4477ab9cc9..a5c026a74311 100644
--- a/canvas/inc/canvas/base/canvascustomspritebase.hxx
+++ b/canvas/inc/canvas/base/canvascustomspritebase.hxx
@@ -103,14 +103,14 @@ namespace canvas
@derive when overriding this method in derived classes,
<em>always</em> call the base class' method!
*/
- virtual void SAL_CALL disposing()
+ virtual void disposeThis()
{
typename BaseType::MutexType aGuard( BaseType::m_aMutex );
maSpriteHelper.disposing();
// pass on to base class
- BaseType::disposing();
+ BaseType::disposeThis();
}
// XCanvas: selectively override base's methods here, for opacity tracking
diff --git a/canvas/inc/canvas/base/basemutexhelper.hxx b/canvas/inc/canvas/base/disambiguationhelper.hxx
index c1c7eed8455e..b58ed29ea289 100644
--- a/canvas/inc/canvas/base/basemutexhelper.hxx
+++ b/canvas/inc/canvas/base/disambiguationhelper.hxx
@@ -26,30 +26,37 @@
*
************************************************************************/
-#ifndef INCLUDED_CANVAS_BASEMUTEXHELPER_HXX
-#define INCLUDED_CANVAS_BASEMUTEXHELPER_HXX
+#ifndef INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX
+#define INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX
#include <osl/mutex.hxx>
-/* Definition of the BaseMutexHelper class */
+/* Definition of the DisambiguationHelper class */
namespace canvas
{
- /** Base class, deriving from ::comphelper::OBaseMutex and
- initializing its own baseclass with m_aMutex.
+ /** Base class, initializing its own baseclass with m_aMutex.
This is necessary to make the CanvasBase, GraphicDeviceBase,
etc. classes freely combinable - letting them perform this
initialization would prohibit deriving e.g. CanvasBase from
GraphicDeviceBase.
+
+ On top of that, disambiguates XEventListener::disposing and
+ WeakComponentImplHelper::disposing.
+
+ Having two virtual methods with the same name, and not
+ overriding them in every derived class, will hide one of
+ them. Later trying to override the same method, will generate
+ a new vtable slot, and lead to very hard to spot errors.
*/
- template< class Base > class BaseMutexHelper : public Base
+ template< class Base > class DisambiguationHelper : public Base
{
public:
typedef Base BaseType;
- /** Construct BaseMutexHelper
+ /** Construct DisambiguationHelper
This method is the whole purpose of this template:
initializing a base class with the provided m_aMutex
@@ -57,16 +64,27 @@ namespace canvas
as they require the lifetime of the mutex to extend
theirs).
*/
- BaseMutexHelper() :
+ DisambiguationHelper() :
BaseType( m_aMutex )
{
}
+ virtual void SAL_CALL disposing()
+ { disposeThis(); }
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
+ { disposeEventSource(Source); }
+
+ virtual void disposeThis()
+ {}
+ virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ {}
+
protected:
mutable ::osl::Mutex m_aMutex;
};
}
-#endif /* INCLUDED_CANVAS_BASEMUTEXHELPER_HXX */
+#endif /* INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/canvas/base/graphicdevicebase.hxx b/canvas/inc/canvas/base/graphicdevicebase.hxx
index 62424e4cdabd..b8baee2417b9 100644
--- a/canvas/inc/canvas/base/graphicdevicebase.hxx
+++ b/canvas/inc/canvas/base/graphicdevicebase.hxx
@@ -95,7 +95,7 @@ namespace canvas
@tpl Mutex
Lock strategy to use. Defaults to using the
- BaseMutexHelper-provided lock. Everytime one of the methods is
+ DisambiguationHelper-provided lock. Everytime one of the methods is
entered, an object of type Mutex is created with m_aMutex as
the sole parameter, and destroyed again when the method scope
is left.
@@ -144,17 +144,14 @@ namespace canvas
_1)));
}
-#if defined __SUNPRO_CC
- using Base::disposing;
-#endif
- virtual void SAL_CALL disposing()
+ virtual void disposeThis()
{
MutexType aGuard( BaseType::m_aMutex );
maDeviceHelper.disposing();
// pass on to base class
- cppu::WeakComponentImplHelperBase::disposing();
+ BaseType::disposeThis();
}
// XGraphicDevice
diff --git a/canvas/inc/canvas/base/spritecanvasbase.hxx b/canvas/inc/canvas/base/spritecanvasbase.hxx
index 1cf255fe5579..47134abfc2d5 100644
--- a/canvas/inc/canvas/base/spritecanvasbase.hxx
+++ b/canvas/inc/canvas/base/spritecanvasbase.hxx
@@ -86,17 +86,14 @@ namespace canvas
{
}
-#if defined __SUNPRO_CC
- using Base::disposing;
-#endif
- virtual void SAL_CALL disposing()
+ virtual void disposeThis()
{
typename BaseType::MutexType aGuard( BaseType::m_aMutex );
maRedrawManager.disposing();
// pass on to base class
- BaseType::disposing();
+ BaseType::disposeThis();
}
// XSpriteCanvas