summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--src/Fl_Widget.cxx9
-rw-r--r--src/Fl_Window.cxx14
3 files changed, 12 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index b282478c1..d2b8e0c8c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
CHANGES IN FLTK 1.3.2
+ - Fixed Fl_Widget::copy_label() and Fl_Window::copy_label() when
+ called with the old label() (STR #2836)
+
1.3.2 ABI FEATURES
(To enable the following ABI features, put: #define FLTK_ABI_VERSION 10302
at the top of your FL/Enumerations.H and rebuild FLTK and your app)
diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx
index 79cafa2c4..50139cb22 100644
--- a/src/Fl_Widget.cxx
+++ b/src/Fl_Widget.cxx
@@ -303,13 +303,14 @@ Fl_Widget::label(const char *a) {
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();
}
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index 7ca25a220..f5c295d77 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -139,22 +139,16 @@ void Fl_Window::draw() {
}
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