]> git.lyx.org Git - features.git/commitdiff
Ok, so I'm a donkey! Easy, easy fix to that ol' memory leak. (And it was
authorAngus Leeming <leeming@lyx.org>
Thu, 13 Sep 2001 11:44:07 +0000 (11:44 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 13 Sep 2001 11:44:07 +0000 (11:44 +0000)
suggested days ago by Lars too :-()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2753 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/FormMathsBitmap.C
src/frontends/xforms/FormMathsBitmap.h

index d60c2a1b9f0074103d45db5ce6358c5ae8b78a3c..9c529a5eb0068ef97efd15e6576bab033440a85e 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-13  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * FormMathsBitmap.[Ch]: add d-tor to finally fix a memory leak.
+       Hoorah! Happy Birthday to me!
+
 2001-09-07  Dekel Tsur  <dekelts@tau.ac.il>
 
        * forms/form_ref.fd: Add buffer button.
index 5f70f6d7fe85aaf371cceda6ce39d8bcdb3916f9..0239867db3dee3fc6a94dabf71b713989bd78db6 100644 (file)
@@ -48,6 +48,16 @@ FormMathsBitmap::FormMathsBitmap(LyXView * lv, Dialogs * d,
 }
 
 
+FormMathsBitmap::~FormMathsBitmap()
+{
+       if (!form())
+               return;
+
+       if (form()->visible) fl_hide_form(form());
+       fl_free_form(form());
+}
+
+
 FL_FORM * FormMathsBitmap::form() const
 {
        return form_.get();
@@ -63,8 +73,7 @@ void FormMathsBitmap::build()
        form_.reset(fl_bgn_form(FL_UP_BOX, w_, h_));
        form_->u_vdata = this;
 
-       FL_OBJECT * obj = fl_add_box(FL_UP_BOX, 0, 0, w_, h_, "");
-       //fl_add_object(form_.get(), obj);
+       fl_add_box(FL_UP_BOX, 0, 0, w_, h_, "");
 
        y_ = 0;
        for (vector<bm_ptr>::const_iterator it = bitmaps_.begin();
@@ -78,16 +87,14 @@ void FormMathsBitmap::build()
        }
  
        char const * const label = N_("Close|^[");
-
        x_ = (form_->w - 90) / 2;
        y_ += 10;
-               
-       FL_OBJECT * button_cancel = obj =
+
+       FL_OBJECT * button_cancel =
                fl_add_button(FL_NORMAL_BUTTON, x_, y_, 90, 30, idex(_(label)));
-       //fl_add_object(form_.get(), obj);
-       fl_set_button_shortcut(obj, scex(_(label)), 1);
-       fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-       fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0);
+       fl_set_button_shortcut(button_cancel, scex(_(label)), 1);
+       fl_set_object_lsize(button_cancel, FL_NORMAL_SIZE);
+       fl_set_object_callback(button_cancel, C_FormBaseDeprecatedCancelCB, 0);
 
        fl_end_form();
 
index ed39b6c15333fe693fead992d782cccb11fc64ab..4d9495e630643f724fde6db7245f6eee423e57b3 100644 (file)
@@ -39,6 +39,8 @@ public:
        FormMathsBitmap(LyXView *, Dialogs * d, FormMathsPanel const &,
                        std::vector<string> const &);
        ///
+       ~FormMathsBitmap();
+       ///
        void addBitmap(int, int, int, int, int, unsigned char const *,
                       bool = true);