diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Widget.cxx | 9 | ||||
| -rw-r--r-- | src/Fl_Window.cxx | 14 |
2 files changed, 9 insertions, 14 deletions
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 |
