FLTK logo

[Library] r9019 - in branches/branch-3.0: include/fltk3 src/fltk3

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[Library] r9019 - in branches/branch-3.0: include/fltk3 src/fltk3 fltk-dev Aug 28, 2011  
 
Author: matt
Date: 2011-08-28 08:30:35 -0700 (Sun, 28 Aug 2011)
New Revision: 9019
Log:
Fixed destructor for flk3::Label

Modified:
   branches/branch-3.0/include/fltk3/Widget.h
   branches/branch-3.0/include/fltk3/all.h
   branches/branch-3.0/src/fltk3/Widget.cxx

Modified: branches/branch-3.0/include/fltk3/Widget.h
===================================================================
--- branches/branch-3.0/include/fltk3/Widget.h	2011-08-28 09:39:18 UTC (rev 9018)
+++ branches/branch-3.0/include/fltk3/Widget.h	2011-08-28 15:30:35 UTC (rev 9019)
@@ -108,6 +108,8 @@
     
     Label();
     
+    ~Label();
+    
     /** Draws the label aligned to the given box */
     void draw(int,int,int,int, fltk3::Align) const ;
     

Modified: branches/branch-3.0/include/fltk3/all.h
===================================================================
--- branches/branch-3.0/include/fltk3/all.h	2011-08-28 09:39:18 UTC (rev 9018)
+++ branches/branch-3.0/include/fltk3/all.h	2011-08-28 15:30:35 UTC (rev 9019)
@@ -30,7 +30,6 @@
 
 #include "x.h"
 #include "Adjuster.h"
-// #include "BMPImage.h"
 #include "Bitmap.h"
 #include "Box.h"
 #include "Browser.h"
@@ -56,9 +55,7 @@
 #include "FillDial.h"
 #include "FillSlider.h"
 #include "FloatInput.h"
-// #include "GIFImage.h"
 #include "Group.h"
-// #include "HelpDialog.h"
 #include "HelpView.h"
 #include "HoldBrowser.h"
 #include "HorFillSlider.h"
@@ -70,7 +67,6 @@
 #include "InputChoice.h"
 #include "Input_.h"
 #include "IntInput.h"
-// #include "JPEGImage.h"
 #include "LightButton.h"
 #include "LineDial.h"
 #include "Menu.h"

Modified: branches/branch-3.0/src/fltk3/Widget.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Widget.cxx	2011-08-28 09:39:18 UTC (rev 9018)
+++ branches/branch-3.0/src/fltk3/Widget.cxx	2011-08-28 15:30:35 UTC (rev 9019)
@@ -107,7 +107,7 @@
 fltk3::Label::Label(int X, int Y, int W, int H, const char* L) 
 : fltk3::Rectangle(X, Y, W, H),
   labeltext_(L),
-  labeltype_(fltk3::NORMAL_LABEL),
+labeltype_(fltk3::NORMAL_LABEL),
   labelcolor_(fltk3::FOREGROUND_COLOR),
   labelfont_(fltk3::HELVETICA),
   labelsize_(fltk3::NORMAL_SIZE),
@@ -123,7 +123,7 @@
 
 fltk3::Label::Label(const fltk3::Label &s) 
 : fltk3::Rectangle(s),
-  labeltext_(s.labeltext_), // FIXME: we must copy the label text!
+  labeltext_(0L),
   labeltype_(s.labeltype_),
   labelcolor_(s.labelcolor_),
   labelfont_(s.labelfont_),
@@ -136,6 +136,13 @@
   image_(s.image_),
   deimage_(s.deimage_)
 {
+  if (s.labeltext_) {
+    if (s.flags() & COPIED_LABEL) {
+      copy_label(s.labeltext_);
+    } else {
+      labeltext_ = s.labeltext_;
+    }
+  }
 }
 
 fltk3::Label::Label() 
@@ -154,6 +161,11 @@
 {
 }
 
+fltk3::Label::~Label() {
+  if (flags() & COPIED_LABEL) 
+    free((void *)(labeltext_));
+}
+
 ////////////////////////////////////////////////////////////////
 
 int fltk3::Widget::handle(int event) {
@@ -211,7 +223,6 @@
 */
 fltk3::Widget::~Widget() {
   fltk3::clear_widget_pointer(this);
-  if (flags() & COPIED_LABEL) free((void *)(labeltext_));
   if (flags() & COPIED_TOOLTIP) free((void *)(tooltip_));
   // remove from parent group
   if (parent_) parent_->remove(this);

Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.