summaryrefslogtreecommitdiff
path: root/tubes/source/contacts.cxx
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-08-03 14:02:01 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-08-04 01:57:11 +0200
commit4e648b8e7c65fd8c382baf6b6798cdedfac5cdd8 (patch)
tree54117d9e82a40d480cbbee7feb7d28a1d3f63fd8 /tubes/source/contacts.cxx
parentf2c7d7aea4ec8c1f9f38e1d00c14dadca67b863e (diff)
tubes: create contacts dialog instance for each document separately
This solves a crash when static dialog instance was destroyed on closing of one document but then was used in another document. Change-Id: I6ac9edb1de83f638bdf4ce7c0814fcbdf4b4b1e5
Diffstat (limited to 'tubes/source/contacts.cxx')
-rw-r--r--tubes/source/contacts.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/tubes/source/contacts.cxx b/tubes/source/contacts.cxx
index 540e8a6f4725..9245b55284b4 100644
--- a/tubes/source/contacts.cxx
+++ b/tubes/source/contacts.cxx
@@ -42,10 +42,13 @@
#include <vcl/dialog.hxx>
#include <vcl/unohelp.hxx>
+#include <map>
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
#include <telepathy-glib/telepathy-glib.h>
+namespace {
+
ResId TubesResId( sal_uInt32 nId )
{
static ResMgr* pResMgr = NULL;
@@ -56,7 +59,6 @@ ResId TubesResId( sal_uInt32 nId )
return ResId( nId, *pResMgr );
}
-namespace {
class TubeContacts : public ModelessDialog
{
FixedLine maLabel;
@@ -261,12 +263,22 @@ IMPL_LINK_NOARG( TubeContacts, BtnListenHdl )
return 0;
}
+TubeContacts* ContactsFactory( Collaboration* pCollaboration )
+{
+ // Mapping contacts dialog instance for each document
+ static std::map< sal_uInt64, TubeContacts* > aDialogsMap;
+ sal_uInt64 Id = pCollaboration->GetId();
+ if (aDialogsMap.find( Id ) == aDialogsMap.end())
+ aDialogsMap[ Id ] = new TubeContacts( pCollaboration );
+ return aDialogsMap[ Id ];
+}
+
} // anonymous namespace
namespace tubes {
void createContacts( Collaboration* pCollaboration )
{
- static TubeContacts *pContacts = new TubeContacts( pCollaboration );
+ TubeContacts* pContacts = ContactsFactory( pCollaboration );
pContacts->Populate();
}
}