title: C++ how to delete Singleton object's used in many classes
body: <p>Let's say I have 3 classes(A, B and C). Every class has an instance variable of the Singleton class and uses this instance variable in some functions of the class.</p>
  
  <p>This class could look like this:</p>
  
  <pre><code>SingletonClass* mSingletonClass; // declared in header file
  
  mSingletonClass = SingletonClass::getInstance(); // called in constructor
  
  mSingletonClass-&gt;doSomething();     // called in function doSomething()
  mSingletonClass-&gt;doSomething1();    // called in function doSomething1()
  </code></pre>
  
  <p><strong>SingletonClass.h</strong></p>
  
  <pre><code>class SingletonClass : public QObject {
      Q_OBJECT
  public:
      static SingletonClass* getInstance();
  
      // some functions
  private:
      SingletonClass();
      SingletonClass(SingletonClass const&amp;);
      SingletonClass&amp; operator=(SingletonClass const&amp;);
      static SingletonClass* mInstance;
  };
  </code></pre>
  
  <p><strong>SingletonClass.m</strong></p>
  
  <pre><code>SingletonClass* SingletonClass::mInstance = 0;
  
  SingletonClass* SingletonClass::getInstance() {
      if (!mInstance) {
          mInstance = new SingletonClass();
      }
  
      return mInstance;
  }
  
  SingletonClass::SingletonClass() : QObject() {
  }
  </code></pre>
  
  <p>How am I supposed to <code>delete</code> the instance variables?</p>
  
  <p>If I call <code>delete mSingletonClass;</code> on every deconstructor(A, B and C), the application crashes.</p>
  
  <p>Is it "enough" if I just call <code>delete mSingletonClass;</code> once, for instance in Class A?</p>