Denis Oliver Kropp wrote: > Tom Cooksey wrote: >> I'm copying a sub-rect of a DirectFB surface into a newly created surface. >> After creating a new surface of the correct size and format, I issue: >> >> dest->Blit(dest, src, &blitRect, 0, 0); >> >> However, before performing the blit, I also copy the palette from the old >> surface to the new one: >> >> IDirectFBPalette *palette; >> src->GetPalette(src, &palette); >> dest->SetPalette(surface, palette); >> >> >> What is GetPalette actually supposed to do? I assume from the docs it will >> just return a pointer to the surface's palette? However I'm being told that >> it's showing up in profiling as a memory leak. Does GetPalette allocate any >> memory? I.e. Do I need to either delete and/or Relese it after setting the >> dest's palette? > > Yes, SetPalette() AddRef's IDirectFBPalette, so Release() it!
Not exactly: GetPalette() creates a new instance of IDirectFBPalette while SetPalette() only uses the underlying CorePalette (FusionObject), increasing its reference count, but not that of IDirectFBPalette (Interface). But still you should Release() the interface that has been created by GetPalette(). -- Best regards, Denis Oliver Kropp .------------------------------------------. | DirectFB - Hardware accelerated graphics | | http://www.directfb.org/ | "------------------------------------------" _______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users