Both the c function "menu_set_entry_text" and the corresponding SWI show this
behaviour.
If you call it twice in succession for the same menu entry with the same
text it freezes the wimp and requires a reboot!
Calling it once, or twice with different text, or alternating two different
texts are OK.
Pointers to two different areas of memory containing identical characters are
enough to cause the crash!
I found this quite difficult to understand, the only explanation I can think
of is that the toolbox shares storage for identical strings, and has
messed up some sort of usage count. Adding another menu entry with the same
name does not help. I have not checked whether any other toolbox string
setting commands do the same.
Setting the same menu entry with the same string is not as stupid as it
might seem. In my case the user could enter a name in a writeable icon,
and I thought it was easier to always set the menu entry, rather than
checking whether the user had changed the icon text.
If this feature is not well known can someone remind me how to report it to
Acorn.
Chris Stretch
ct.st...@ulst.ac.uk
(please ignore the address in the news header)
>If you call it twice in succession for the same menu entry with the same
>text it freezes the wimp and requires a reboot!
>Calling it once, or twice with different text, or alternating two different
>texts are OK.
>Pointers to two different areas of memory containing identical characters are
>enough to cause the crash!
The explanation could perhaps be found in the C reference guide, somewhere
in the begining when it discusses the implementation of Acorns's C. On the
right hand page it says that if you do:
char *a='Hello World 1';
char *b='Hello World 2';
and
char *c='Hello World';
char *d='Hello World';
that a and b will, after compilation, (obviously) point to different
locations whereas c and d might (or actually will) point to the same
location. Might this be an explanation ?
Just an idea
Dw.
Does this happen only for writable menu icons?
The reason I ask is that I seem to remember reading somewhere in the
toolbox docs that you should not use writable menu icons with the menu
class.
Chic.
--
=========================================================================
| Sanjay Pattni, 105 Sterling Place, London W5 4RD, England. |
| Tel. (+44)(0) 181 - 568 9167 Email: s.pa...@ic.ac.uk |
| My new web page URL: "http://www.pp.ph.ic.ac.uk/~spattni/" |
=========================================================================
> > Setting the same menu entry with the same string is not as stupid as it
> > might seem. In my case the user could enter a name in a writeable icon,
> > and I thought it was easier to always set the menu entry, rather than
> > checking whether the user had changed the icon text.
>
> Does this happen only for writable menu icons?
> The reason I ask is that I seem to remember reading somewhere in the
> toolbox docs that you should not use writable menu icons with the menu
> class.
You can't use writable menu entries with the Toolbox. I suspect the text
being referred to is coming from a writable icon somewhere else.
--
Mark Smith - Microelectronics Student & Acorn Software Developer.
All comments reflect my personal thoughts only. I reserve the right to be wrong.
.. Is this yours? Your dog left it on my lawn ...
I haven't seen the original posting to this but I guess it must have
said something about a stiff machine if you use menu_set_text_entry
with a string identical to the one already there. This is a known
bug in Menu 0.22, and is fixed in Menu 0.24 which will be released
in the Update to Acorn C/C++.
-- Ian
(Acorn C/C++ Project Mgr).
Yep, I've just found this for menu_set_title. How long do we have
to wait for this update? Just wondering as to whether its worth
adding code to get round it or just ignore the title for now?
PS. Any more news as to when the updated flex may appear?
--
Kevin Pearcey
> I haven't seen the original posting to this but I guess it must have
> said something about a stiff machine if you use menu_set_text_entry
> with a string identical to the one already there. This is a known
> bug in Menu 0.22, and is fixed in Menu 0.24 which will be released
> in the Update to Acorn C/C++.
>
> -- Ian
>
> (Acorn C/C++ Project Mgr).
>
Any ideas about when this Update will be?
____________________________________________________________
Ian Hinder i...@advunit.demon.co.uk ARM Powered
____________________________________________________________
... A clean, neat, desk is a sign of a very sick mind.