Author: AlbrechtS
Date: 2012-05-05 07:45:47 -0700 (Sat, 05 May 2012)
New Revision: 9445
Log:
Fix STR #2836: copy_label() with old label() value failed.
(cf. FLTK 1.3, svn r 9443)


Modified:
   branches/branch-3.0/src/fltk3/Widget.cxx
   branches/branch-3.0/src/fltk3/Window.cxx

Modified: branches/branch-3.0/src/fltk3/Widget.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Widget.cxx    2012-05-05 14:41:16 UTC (rev 
9444)
+++ branches/branch-3.0/src/fltk3/Widget.cxx    2012-05-05 14:45:47 UTC (rev 
9445)
@@ -356,13 +356,14 @@
 
 void
 fltk3::Label::copy_label(const char *a) {
-  if (flags() & COPIED_LABEL) free((void *)(labeltext_));
+  // reassigning a copied label remains the same copied label
+  if ((flags() & COPIED_LABEL) && (labeltext_ == a))
+    return;
   if (a) {
+    label(strdup(a));
     set_flag(COPIED_LABEL);
-    labeltext_ = strdup(a);
   } else {
-    clear_flag(COPIED_LABEL);
-    labeltext_ = (char *)0;
+    label(0);
   }
   redraw_label();
 }

Modified: branches/branch-3.0/src/fltk3/Window.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Window.cxx    2012-05-05 14:41:16 UTC (rev 
9444)
+++ branches/branch-3.0/src/fltk3/Window.cxx    2012-05-05 14:45:47 UTC (rev 
9445)
@@ -152,13 +152,8 @@
 }
 
 void fltk3::Window::copy_label(const char *a) {
-  if (flags() & COPIED_LABEL) {
-    free((void *)label());
-    clear_flag(COPIED_LABEL);
-  }
-  if (a) a = strdup(a);
+  fltk3::Label::copy_label(a);
   label(a, iconlabel());
-  set_flag(COPIED_LABEL);
 }
 
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to