GDI Object leak in CombineDIB

Document Imaging SDK,
Image SDK,
TIFF SDK,
Annotation SDK,
Cover Page Generator

Moderator: Technical Support Team

GDI Object leak in CombineDIB

Postby frederic Chiesi » Tue Jul 09, 2013 1:52 am

Hello,

I'm using Blackice SDK 12.05 on windows server 2012 and attempt to combine several dibs, but it seems i'm not releasing correctly the hdib objects or there is a bug in CombineDib function.

Each time i call the combineDib function, One GDI object is created. It is never released.

Please check this c++ sample code (simple loop with 2 dib creation and a combination)

Code: Select all
for(int i=0;i<100;i++) {

   //White page
   SIZE backgroundSize;
   backgroundSize.cx = 2156;
   backgroundSize.cy = 1728;
   if(HANDLE background = CreateEmptyDIB(backgroundSize, 204, 196, 1, TRUE))
   {
      //black page
      SIZE foregroundSize;
      foregroundSize.cx = 2000;
      foregroundSize.cy = 1000;
      if(HANDLE foreground = CreateEmptyDIB(foregroundSize, 204, 196, 1, FALSE))
      {
         //combine black on white with a decals and without a mask
         if(CombineDIB(156, 728, &background, foreground, NULL, COMB_OPAQUE))
         {
            //other code (save as tiff) //etc
         }
   
         GlobalFree(foreground);
      }
   
      GlobalFree(background);
   }
   
}


I've tried releasing with GlobalFree, GlobalUnlock/GlobalFree, DeleteObject, but none of them release the GDI objects, they keep increasing their count at each loop iteration. (you can view the GDI object count in the Task Manager (add column 'GDI Objects' ))

Can you explain me this problem?
frederic Chiesi
 
Posts: 2
Joined: Mon Nov 21, 2011 8:30 am

Re: GDI Object leak in CombineDIB

Postby frederic Chiesi » Wed Jul 10, 2013 9:15 am

anyone for some help about releasing GDI objects after a CombineDib ?
frederic Chiesi
 
Posts: 2
Joined: Mon Nov 21, 2011 8:30 am


Return to Imaging Toolkits



Who is online

Users browsing this forum: No registered users and 1 guest

cron