Kaydet (Commit) 115e3dda authored tarafından Caolán McNamara's avatar Caolán McNamara

valgrind: use non-leaky singleton pattern

üst a114d5ef
...@@ -94,9 +94,9 @@ ...@@ -94,9 +94,9 @@
class SVX_DLLPUBLIC SvxErrorHandler : private SfxErrorHandler class SVX_DLLPUBLIC SvxErrorHandler : private SfxErrorHandler
{ {
public: public:
SvxErrorHandler(); SvxErrorHandler();
static void Get(); static void ensure();
}; };
#endif #endif
......
...@@ -37,20 +37,23 @@ ...@@ -37,20 +37,23 @@
#include <svx/dialogs.hrc> #include <svx/dialogs.hrc>
static SvxErrorHandler* pHandler=NULL; #include <rtl/instance.hxx>
SvxErrorHandler::SvxErrorHandler() : SvxErrorHandler::SvxErrorHandler() :
SfxErrorHandler( SfxErrorHandler(
RID_SVXERRCODE, ERRCODE_AREA_SVX, ERRCODE_AREA_SVX_END, &DIALOG_MGR() ) RID_SVXERRCODE, ERRCODE_AREA_SVX, ERRCODE_AREA_SVX_END, &DIALOG_MGR() )
{ {
pHandler = this;
} }
void SvxErrorHandler::Get() namespace
{
class theSvxErrorHandler
: public rtl::Static<SvxErrorHandler, theSvxErrorHandler> {};
}
void SvxErrorHandler::ensure()
{ {
if ( !pHandler ) theSvxErrorHandler::get();
new SvxErrorHandler;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment