Author: fabien
Date: 2012-04-21 08:05:00 -0700 (Sat, 21 Apr 2012)
New Revision: 9366
Log:
STR2783: make potential null string substituted to an empty string, still
achieve internal cleanup in Fl_Text_Buffer::text(s)
Modified:
branches/branch-1.3/FL/Fl_Text_Buffer.H
branches/branch-1.3/src/Fl_Text_Buffer.cxx
Modified: branches/branch-1.3/FL/Fl_Text_Buffer.H
===================================================================
--- branches/branch-1.3/FL/Fl_Text_Buffer.H 2012-04-21 11:13:10 UTC (rev
9365)
+++ branches/branch-1.3/FL/Fl_Text_Buffer.H 2012-04-21 15:05:00 UTC (rev
9366)
@@ -188,7 +188,7 @@
/**
Replaces the entire contents of the text buffer.
- \param text Text must be valid utf8.
+ \param text Text must be valid utf8. if null an empty string is substituted.
*/
void text(const char* text);
Modified: branches/branch-1.3/src/Fl_Text_Buffer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Buffer.cxx 2012-04-21 11:13:10 UTC (rev
9365)
+++ branches/branch-1.3/src/Fl_Text_Buffer.cxx 2012-04-21 15:05:00 UTC (rev
9366)
@@ -165,7 +165,11 @@
void Fl_Text_Buffer::text(const char *t)
{
IS_UTF8_ALIGNED(t)
-
+
+ // if t is null then substitute it with an empty string
+ // then don't return so that internal cleanup can happen
+ if (!t) t="";
+
call_predelete_callbacks(0, length());
/* Save information for redisplay, and get rid of the old buffer */
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit