]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspace.C
prevent crash when inserting minipage in table cell,
[lyx.git] / src / insets / insetspace.C
index 5cee67dcd423d3ad7412a1bdc2f772568d7b48b0..eb333e649cec19e6353d3192973caaa65049ebb2 100644 (file)
@@ -28,6 +28,7 @@
 
 using std::ostream;
 using std::max;
+using std::auto_ptr;
 
 
 InsetSpace::InsetSpace()
@@ -71,12 +72,13 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
                        dim.wid = 10;
                        break;
        }
+       dim_ = dim;
 }
 
 
 void InsetSpace::draw(PainterInfo & pi, int x, int y) const
 {
-       int const w = width(pi.base.bv, pi.base.font);
+       int const w = width();
        int const h = font_metrics::ascent('x', pi.base.font);
        int xp[4], yp[4];
 
@@ -250,9 +252,9 @@ int InsetSpace::docbook(Buffer const *, ostream & os, bool) const
 }
 
 
-InsetBase * InsetSpace::clone() const
+auto_ptr<InsetBase>  InsetSpace::clone() const
 {
-       return new InsetSpace(kind_);
+       return auto_ptr<InsetBase>(new InsetSpace(kind_));
 }