On Tue, Aug 29, 2000 at 10:02:51PM +0200, Lars Gullik Bj&resh;nnes wrote:
> | 
> | Look at the following code from the old menu code
> | 
> |         for (LastFiles::const_iterator cit = lastfiles->begin();
> |              cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
> |                 string tmp = tostr(ii);
> |                 tmp += ". " + MakeDisplayPath((*cit), 30);
> |                 fl_addtopup(FileMenu, tmp.c_str());
> |         }
> 
> That this works could be just luck.
> 
> | Since this code works, it appears that fl_addtopup creates an internal
> | copy of the string, which means that we don't need the string pool.

I also tried the following code
      char buffer[200];
      for (LastFiles::const_iterator cit = lastfiles->begin();
              cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
                string tmp = tostr(ii);
                tmp += ". " + MakeDisplayPath((*cit), 30);
                strcpy(buffer, tmp.c_str());
                fl_addtopup(FileMenu, buffer);

and it worked. Now this MUST means that fl_addtopup keeps a local copy of
the string (at least in XForms 0.88 on which I tested).

> We should check this with XForms documentation and/or the xforms
> mailinglist.

I couldn't find information on this in the documentation.

Reply via email to