[haiku] Re: Behavior of popup menus

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Mon, 20 Dec 2010 16:28:51 +0100

Am 20.12.2010 14:24, schrieb Travis D. Reed:
Thanks for responding! Just to be clear, as far as I can tell, the only
change in behavior a release-to-select person would have to make is that
selecting the first menu item in a list would entail moving the mouse by
a couple of pixels (behavior already required in Tracker,
ProcessController...).

[...]
 (just create it on the stack instead)
Done...I think. :-/

No, you are making a serious mistake. You allocate the BRect on the stack, but within the scope of the "if (startOpenened...)" block. As soon as the leave the scope at the closing parenthesis, the stack space for the BRect may be reclaimed by the compiler, which means the _specialRect pointer points to freed memory.


IMHO, the patch does not address the issue you pointed out, since the behavior is still not guaranteed to be consistent, for example it does not address existing applications and new apps may still chose to override the defaults. I think the solution should be to completely ignore the respective arguments passed to the BPopUpMenu constructor and to the Go() method respectively. And create an internal implementation that fullfills does what was previously done by apps. Thus new applications can ignore these (API documentation needs to mention that these arguments are now ignored by the implementation). And old apps have their non-consistent behavior overridden.

Best regards,
-Stephan

Other related posts: