diff --git a/Code/Mantid/MantidPlot/CMakeLists.txt b/Code/Mantid/MantidPlot/CMakeLists.txt
index 9d8c0757f97f80e0a24a4d8fdf8ecf49b2b1f013..1fdef82ebaa79533eaa0d66b8c6ea929360b7ffd 100644
--- a/Code/Mantid/MantidPlot/CMakeLists.txt
+++ b/Code/Mantid/MantidPlot/CMakeLists.txt
@@ -613,6 +613,7 @@ set ( QTIPLOT_MOC_FILES src/ApplicationWindow.h
                         src/SigmoidalFit.h
                         src/SmoothCurveDialog.h
                         src/SmoothFilter.h
+                        src/Spectrogram.h
                         src/SortDialog.h
                         src/SurfaceDialog.h
                         src/TableDialog.h
diff --git a/Code/Mantid/MantidPlot/src/Spectrogram.cpp b/Code/Mantid/MantidPlot/src/Spectrogram.cpp
index 01c2ec70f36b48568cf12bc0e71c09ee7c871852..0ffa48f64ad6ba872ae508969f3ed4f228acad49 100644
--- a/Code/Mantid/MantidPlot/src/Spectrogram.cpp
+++ b/Code/Mantid/MantidPlot/src/Spectrogram.cpp
@@ -41,7 +41,7 @@
 #include <numeric>
 
 Spectrogram::Spectrogram():
-	    QwtPlotSpectrogram(),
+      QObject(), QwtPlotSpectrogram(),
 			d_color_map_pen(false),
 			d_matrix(0),d_funct(0),//Mantid
 	    color_axis(QwtPlot::yRight),
@@ -63,7 +63,7 @@ Spectrogram::Spectrogram():
 }
 
 Spectrogram::Spectrogram(Matrix *m):
-	    QwtPlotSpectrogram(QString(m->objectName())),
+      QObject(), QwtPlotSpectrogram(QString(m->objectName())),
 			d_matrix(m),d_funct(0),//Mantid
 	    color_axis(QwtPlot::yRight),
 	    color_map_policy(Default),mColorMap()
@@ -81,7 +81,7 @@ Spectrogram::Spectrogram(Matrix *m):
 }
 
 Spectrogram::Spectrogram(UserHelperFunction *f,int nrows, int ncols,double left, double top, double width, double height,double minz,double maxz)
-:	QwtPlotSpectrogram(),
+:	QObject(), QwtPlotSpectrogram(),
  	d_matrix(0),d_funct(f),
  	color_axis(QwtPlot::yRight),
  	color_map_policy(Default),
@@ -100,7 +100,7 @@ Spectrogram::Spectrogram(UserHelperFunction *f,int nrows, int ncols,double left,
 }
 
 Spectrogram::Spectrogram(UserHelperFunction *f,int nrows, int ncols,QwtDoubleRect bRect,double minz,double maxz)
-:	QwtPlotSpectrogram(),
+:	QObject(), QwtPlotSpectrogram(),
  	d_color_map_pen(false),
  	d_matrix(0),
  	d_funct(f),
diff --git a/Code/Mantid/MantidPlot/src/Spectrogram.h b/Code/Mantid/MantidPlot/src/Spectrogram.h
index ef6c3d85e89b9f5028947489999b862730616ebc..afbad05a4c7a1f11c33069363b79badeb10a6139 100644
--- a/Code/Mantid/MantidPlot/src/Spectrogram.h
+++ b/Code/Mantid/MantidPlot/src/Spectrogram.h
@@ -42,15 +42,18 @@
 #include <fstream>
 #include <float.h>
 #include "MantidQtAPI/MantidColorMap.h"
-#include "Mantid//InstrumentWidget//GLColor.h"
+#include "Mantid/InstrumentWidget/GLColor.h"
 #include <boost/shared_ptr.hpp>
 #include <QPainter>
+#include <qobject.h>
 
 class MatrixData;
 class PlotMarker;
 
-class Spectrogram: public QwtPlotSpectrogram
+class Spectrogram: public QObject, public QwtPlotSpectrogram
 {
+  Q_OBJECT
+
 public:
   Spectrogram();
   Spectrogram(Matrix *m);
diff --git a/Code/Mantid/MantidPlot/test/MantidPlotProxiesTest.py b/Code/Mantid/MantidPlot/test/MantidPlotProxiesTest.py
index a40ca3ba67e057c079f24f1e9a8986c504d1bbfe..c2d3dcae7046d4cc471f2da22bd6ff961e1c9b1b 100644
--- a/Code/Mantid/MantidPlot/test/MantidPlotProxiesTest.py
+++ b/Code/Mantid/MantidPlot/test/MantidPlotProxiesTest.py
@@ -23,6 +23,7 @@ Y = np.append(Y1, Y2)
 E = np.sqrt(Y)
 
 CreateWorkspace(OutputWorkspace="fake", DataX=list(X), DataY=list(Y), DataE=list(E), NSpec=2, UnitX="TOF", YUnitLabel="Counts",  WorkspaceTitle="Faked data Workspace")
+LoadRaw(Filename=r'IRS26173.raw',OutputWorkspace='IRS26173',Cache='Always',LoadLogFiles='0',LoadMonitors='Exclude')
 
 class MantidPlotProxiesTest(unittest.TestCase):
     
@@ -36,6 +37,7 @@ class MantidPlotProxiesTest(unittest.TestCase):
     def try_closing(self, obj, msg=""):
         """ Try closing a graphical object, and
         access the variable to see if it has been set to None """
+        self.assertFalse(obj._getHeldObject() is None, msg + "'s return value was not None to begin with")
         # No closing dialog
         obj.confirmClose(False)
         # This should close (and hopefully delete) obj
@@ -87,22 +89,102 @@ class MantidPlotProxiesTest(unittest.TestCase):
         self.assertTrue(l_active._getHeldObject() is None, "Active Layer object from deleted graph is None")
 
     def test_closing_Layer_objects(self):
+        """ Make a plot then access some contained objects.
+        They should safely be cleared when deleting the graph"""
         g = plotSpectrum("fake", [0,1])
+        g.confirmClose(False)
         l = g.activeLayer()
-        
-        return
-        # FIXME! The following calls fail:
         legend = l.legend()
-        legend2 = l.newLegend()
+        legend2 = l.newLegend("a new legend")
         grid = l.grid()
-        self.assertTrue(legend._getHeldObject() is None, "Deleted legend safely")
-        self.assertTrue(legend2._getHeldObject() is None, "Deleted new legend safely")
-        self.assertTrue(grid._getHeldObject() is None, "Deleted grid safely")
+        errbar = l.errorBarSettings(0)
+        self.assertFalse(legend._getHeldObject() is None, "Object returned correctly")
+        self.assertFalse(legend2._getHeldObject() is None, "Object returned correctly")
+        self.assertFalse(grid._getHeldObject() is None, "Object returned correctly")
+        self.assertFalse(l._getHeldObject() is None, "Object returned correctly")
+        self.assertFalse(errbar._getHeldObject() is None, "Object returned correctly")
+        # Deleting the parent graph should None the children
+        self.try_closing(g, "plotSpectrum()")
+        self.assertTrue(legend._getHeldObject() is None, "Deleted Legend safely")
+        self.assertTrue(legend2._getHeldObject() is None, "Deleted new Legend safely")
+        self.assertTrue(grid._getHeldObject() is None, "Deleted Grid safely")
+        self.assertTrue(l._getHeldObject() is None, "Deleted Layer safely")
+        self.assertTrue(errbar._getHeldObject() is None, "Deleted ErrorBarSettings safely")
         
         #spectrogram = l.spectrogram()
         #self.assertTrue(spectrogram._getHeldObject() is None, "Deleted spectrogram safely")
-
+        
+    def setup_folder(self):
+        """ Create a folder with some windows in it """
+        f = addFolder("test_folder")
+        changeFolder(f)
+        windows = []
+        windows.append(newTable("table"))
+        windows.append(newMatrix("matrix"))
+        windows.append(newPlot3D())
+        windows.append(newGraph("graph"))
+        windows.append(newNote("note"))
+        return (f, windows)
+      
+    def test_Folder_deletion(self):
+        """ Create a folder then delete it """
+        f = addFolder("test_folder")
+        deleteFolder(f)
+        self.assertTrue(f._getHeldObject() is None, "Folder was deleted")
+        
+    def test_Folder_windows(self):
+        """ Access windows through a folder """
+        f, old_windows = self.setup_folder()
+        windows = f.windows()
+        self.assertEqual(len(windows), 5, "5 windows in folder")
+        for window in windows:
+            self.try_closing(window, "Folder.windows()")
+        deleteFolder(f)
+           
     
+    def test_closing_MantidMatrix(self):
+        """ Create a MantidMatrix and then delete it safely """
+        mm = importMatrixWorkspace("fake", visible=True)
+        self.try_closing(mm, "importMatrixWorkspace()")
+
+    def test_closing_MantidMatrix_plotGraph2D(self):
+        """ Make a color fill plot. then delete"""
+        mm = importMatrixWorkspace("fake", visible=True)
+        g = mm.plotGraph2D()
+        screenshot(g, "getInstrumentView", "Call to MantidMatrix.plotGraph2D() on a workspace.")
+        self.try_closing(mm, "importMatrixWorkspace()")
+        self.assertTrue(g._getHeldObject() is None, "Deleted graph safely when the parent MantidMatrix was deleted")
+
+    def test_closing_MantidMatrix_plotGraph3D(self):
+        """ Make a 3D plot. then delete"""
+        mm = importMatrixWorkspace("fake", visible=True)
+        g = mm.plotGraph3D()
+        self.try_closing(mm, "importMatrixWorkspace()")
+        self.try_closing(g, "importMatrixWorkspace().plotGraph3D()")
+        
+    def test_closing_getInstrumentView(self):
+        iv = getInstrumentView("IRS26173")    
+        screenshot(iv, "getInstrumentView", "Call to getInstrumentView() on a workspace.")
+        self.try_closing(iv, "getInstrumentView()")
+        
+    def test_convertToWaterfall(self):
+        g = plotSpectrum("IRS26173",(0,1,2,3,4))
+        convertToWaterfall(g)
+        screenshot(g, "convertToWaterfall", "Call to convertToWaterfall() on a workspace.")
+        self.try_closing(g, "convertToWaterfall()")
+        
+# FIXME: Spectrogram object isn't returned right
+#    def test_MantidMatrix_plotGraph2D(self):
+#        """ Make a color fill plot. then delete"""
+#        mm = importMatrixWorkspace("fake", visible=True)
+#        g = mm.plotGraph2D()
+#        spec = g.activeLayer().spectrogram()
+#        self.try_closing(mm, "importMatrixWorkspace()")
+#        self.assertTrue(g._getHeldObject() is None, "Deleted graph safely")
+#        self.assertTrue(spec._getHeldObject() is None, "Deleted spectrogram safely")
+            
+        
+        
 # Run the unit tests
 mantidplottests.runTests(MantidPlotProxiesTest)