Memory leak while using emoticons on CRichEditCtrl
        Posted  
        
            by Jorg B Jorge
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jorg B Jorge
        
        
        
        Published on 2010-05-31T22:27:20Z
        Indexed on 
            2010/05/31
            22:33 UTC
        
        
        Read the original article
        Hit count: 337
        
I'm developing a text editor class (for a chat application) based on CRichEditCtrl (MFC) with emoticon support.
After i load the emoticon's bitmap, I use the function OleCreateStaticFromData to insert it into CRichEditCtrl. After that i just delete the bitmap object allocated by myself. I can verify (using a GDIView utility) that all resources i allocate have been properly released.
This works perfectly: the bitmap (emoticon) is drawn on the CRichEditCtrl window and is handled just like a character.
My problem is that I don't know how to deallocate the memory (internal) allocated by OleCreateStaticFromData to manage the bitmap (emoticon). The memory allocated for any emoticon used is never released, even if i delete the CRichEditCtrl object. I'd like to know how to fix that issue. Is that a MFC's issue or i'm doing something wrong ?
Thx.
© Stack Overflow or respective owner