At 15:56 2003-3-6 +0100, you wrote:
Meanwhile I came a bit closer to the problem.
The function shown bellow freezes on MemPtrSize() and similar calls even if
called immediatelly at the program beginning.
SayText() is just a simple printf-style alert; TestBmpAlloc() will freeze
even if it is removed.
This sequence of calls:
- works on emulator
- does not work on Thungsten and m515 (but it used to work before!)

static void TestBmpAlloc()
{
 Err error ;
 BitmapType *bmp = BmpCreate( 40, 40, 16, NULL, &error );
 if( error )
 {
  SayText( "error" ) ;
 }
 else
 {
  SayText( "Bmp Created -> %lx", bmp ) ;    // reports 001B70BC
  SayText( "In storage: %s", MemPtrDataStorage(bmp) ? "yes":"no" ) ;    //
freezes (reset needed)
  SayText( "heapId %d", MemPtrHeapID(bmp) ) ;   // freezes (reset needed)
  SayText( "SIZE %ld", MemPtrSize(bmp) ) ;   // freezes (reset needed)
 }
}

In my opinion the code is legal and in agreement with Palm OS Reference.
The reason why I need a sequence like that is that I want to store the
bitmap (into a PDB) and later restore.

A "BitmapType *" is an opaque type on Palm OS, and you cannot assume it points to a memory manager chunk of heap memory. Fortunately, there are routines to do what you want.


Rather than use MemPtrSize, use BmpSize. The bitmap might be an indirect bitmap, so you'd have to also use BmpGetSizes to get the size of both the header and the bitmap data.

--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com



-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to