DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Pending]

Link: http://www.fltk.org/str.php?L2836
Version: 1.3-current
Fix Version: 1.3.1 (r9443)


Fixed in Subversion repository.

Please test new subversion release (r 9443) or use attached patch file
str_2836_copy_label.patch to verify and report, if this solves the issue.

Other developers and testers are welcome to test and report if there are
any side effects.


Link: http://www.fltk.org/str.php?L2836
Version: 1.3-current
Fix Version: 1.3.1 (r9443)
Index: src/Fl_Window.cxx
===================================================================
--- src/Fl_Window.cxx   (revision 9442)
+++ src/Fl_Window.cxx   (working copy)
@@ -139,22 +139,16 @@
 }
 
 void Fl_Window::label(const char *name) {
-  label(name, iconlabel());
+  label(name, iconlabel());    // platform dependent
 }
 
 void Fl_Window::copy_label(const char *a) {
-  if (flags() & COPIED_LABEL) {
-    free((void *)label());
-    clear_flag(COPIED_LABEL);
-  }
-  if (a) a = strdup(a);
-  label(a, iconlabel());
-  set_flag(COPIED_LABEL);
+  Fl_Widget::copy_label(a);
+  label(label(), iconlabel()); // platform dependent
 }
 
-
 void Fl_Window::iconlabel(const char *iname) {
-  label(label(), iname);
+  label(label(), iname);       // platform dependent
 }
 
 // the Fl::atclose pointer is provided for back compatibility.  You
Index: src/Fl_Widget.cxx
===================================================================
--- src/Fl_Widget.cxx   (revision 9442)
+++ src/Fl_Widget.cxx   (working copy)
@@ -303,13 +303,14 @@
 
 void
 Fl_Widget::copy_label(const char *a) {
-  if (flags() & COPIED_LABEL) free((void *)(label_.value));
+  // reassigning a copied label remains the same copied label
+  if ((flags() & COPIED_LABEL) && (label_.value == a))
+    return;
   if (a) {
+    label(strdup(a));
     set_flag(COPIED_LABEL);
-    label_.value=strdup(a);
   } else {
-    clear_flag(COPIED_LABEL);
-    label_.value=(char *)0;
+    label(0);
   }
   redraw_label();
 }
_______________________________________________
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to