Problem in handlers priority inversion

Hi community,

I have two CCMenu’s in the same position. I didn’t change their touch priority, so only the added last touch events will be called.
But, for another CCMenu, I’m changing it’s priority with:
@
CCDirector::sharedDirector()>getTouchDispatcher>setPriority;
@
And this piece of code, changes the others CCMenu’s order, and the first added touch events will be called.
Ok, it is confusing… I will try to explain with an example.
CCMenu A~~ priority~~128;
CCMenu B - priority 128;
CCMenu C
priority 128;
If I change C priority to
127, I will get:

CCMenu C - priority 127;
CCMenu B
priority 128;
CCMenu A
priority –128;

Is it a bug?

Regards,
João Ribeiro

I think it is better to use different priorities.
Now we use stl::sort() to rearrange handlers, and it doesn’t guarantee that the elements which are equal keep their relative order.

Hi Minggo, thanks for the answer.
I understand that, but I think it is not useful to have to set priority for each CCMenu…
I found a workaround to maintain the priority order: I’m duplicating rearrange handlers call. In my example, with this duplication, it comes:

CCMenu C - priority 127;
CCMenu A
priority 128;
CCMenu B
priority –128;

as I wanted.