core: Don't store a reference in CoreCertManager
[quassel.git] / src / core / coreidentity.h
index 72d331c..573f9c5 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2018 by the Quassel Project                        *
+ *   Copyright (C) 2005-2019 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -20,6 +20,8 @@
 
 #pragma once
 
+#include "core-export.h"
+
 #include "identity.h"
 
 #ifdef HAVE_SSL
@@ -34,12 +36,12 @@ class SignalProxy;
 // ========================================
 #ifdef HAVE_SSL
 class CoreIdentity;
-class CoreCertManager : public CertManager
+class CORE_EXPORT CoreCertManager : public CertManager
 {
     Q_OBJECT
 
 public:
-    CoreCertManager(CoreIdentity& identity);
+    CoreCertManager(CoreIdentity* identity);
 
 #    ifdef HAVE_SSL
     const QSslKey& sslKey() const override;
@@ -53,7 +55,7 @@ public slots:
     void setId(IdentityId id);
 
 private:
-    CoreIdentity& identity;
+    CoreIdentity* _identity{nullptr};
 };
 
 #endif  // HAVE_SSL
@@ -61,7 +63,7 @@ private:
 // =========================================
 //  CoreIdentity
 // =========================================
-class CoreIdentity : public Identity
+class CORE_EXPORT CoreIdentity : public Identity
 {
     Q_OBJECT
 
@@ -81,8 +83,6 @@ public:
     void setSslCert(const QByteArray& encoded);
 #endif /* HAVE_SSL */
 
-    CoreIdentity& operator=(const CoreIdentity& identity);
-
 private:
 #ifdef HAVE_SSL
     QSslKey _sslKey;
@@ -95,12 +95,12 @@ private:
 #ifdef HAVE_SSL
 inline const QSslKey& CoreCertManager::sslKey() const
 {
-    return identity.sslKey();
+    return _identity->sslKey();
 }
 
 inline const QSslCertificate& CoreCertManager::sslCert() const
 {
-    return identity.sslCert();
+    return _identity->sslCert();
 }
 
 #endif