summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2020-05-26 15:04:43 +0200
committerRaquel Medina <raquel.medina@konsulko.com>2020-06-01 09:47:13 +0200
commit45dc51ab0564fdec1595f1e193a18abfced88ec5 (patch)
treed1d0622429cef925d47531329de6bd0586e306d6
parentcb62d2ee423ce7e10f4b6dd0127491e60f4cec83 (diff)
enforce engine object access via factory
* use normal std::shared_ptr constructor instead of std::make_shared in MessageEngineFactory * make MessageEngine constructor private Bug-AGL: SPEC-3112 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I9c4b0fe83c6561d3bdea2cbc5d40ba3bda40a756
-rw-r--r--messageengine.h3
-rw-r--r--messageenginefactory.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/messageengine.h b/messageengine.h
index 4639c97..12aa5e9 100644
--- a/messageengine.h
+++ b/messageengine.h
@@ -29,7 +29,6 @@ class MessageEngine : public QObject
{
Q_OBJECT
public:
- explicit MessageEngine(const QUrl &url);
bool sendMessage(std::unique_ptr<Message> message);
Q_SIGNALS:
@@ -48,6 +47,8 @@ class MessageEngine : public QObject
QMap<qint32, QByteArray> m_calls;
QUrl m_url;
std::atomic<unsigned int> m_callid;
+
+ explicit MessageEngine(const QUrl &url);
friend class MessageEngineFactory;
};
diff --git a/messageenginefactory.cpp b/messageenginefactory.cpp
index db5c70b..04fb741 100644
--- a/messageenginefactory.cpp
+++ b/messageenginefactory.cpp
@@ -31,7 +31,7 @@ std::shared_ptr<MessageEngine> MessageEngineFactory::getMessageEngine(const QUrl
auto urlstr = url.toString();
auto pme = lut[urlstr];
if (!pme){
- pme = std::make_shared<MessageEngine>(url);
+ pme = std::shared_ptr<MessageEngine>{new MessageEngine(url)};
lut[urlstr] = pme;
}