I ran into a problem today that was completely unexpected. It was easily solved with a workaround, but I'm left curious as to why it happened at all.
In our app, we occasionally construct and post our own events to the event queue. One case, in an extended gadget, looks something like this: theEvent.eType = frmGadgetMiscEvent; theEvent.data.gadgetMisc.gadgetID = fGadgetP->id; theEvent.data.gadgetMisc.gadgetP = (FormGadgetType *)fGadgetP; theEvent.data.gadgetMisc.selector = kZoomGadget; theEvent.data.gadgetMisc.dataP = (void *)theData; EvtAddEventToQueue( &theEvent ); In this case, we're building a gadgetMisc event, and "theData" points to a global struct containing 4 doubles and a Boolean, previously filled in. This works fine on every machine we have except the Tungsten (ARM): in that case, the event handler, when trying to handle this event, finds that theEvent.data.gadgetMisc.dataP has changed! It's not the same as the original pointer we set when building the event. The high 2 bytes seem to be preserved, the low 2 bytes are something else. This was easily fixed by simply referring directly to the global struct from the event handler, and bypassing the "pointer in the event record" entirely. But I'm still curious why it happened at all. Does anyone know why this would be so? By the way, I tried allocating the structure with MemPtrNew() every time instead of using the global struct (thinking that maybe the alignment of our global data was at fault), but got the same result. Thanks for any insight, Dave Johnson -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
