C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[53810] TBitmap항목을 List에 넣고 빼는 방법
조영일 [alberddo] 1020 읽음    2008-06-30 15:28
TBitmap항목을 List에 넣고 빼는 경우에 일반메모리 처리하는 것과 다른가요?
TList에 TBitmap항목을 넣은 경우에는 처리방법이 다른지 알고 싶습니다.
    m_plstDisplayBitmap = new TList;
    m_pDrawBitmap       = new Graphics::TBitmap();
    m_pDrawBitmap->Canvas->CopyRect(m_PanRect, m_pPanBitmap->Canvas, Rect(7.5, 0, 748.5, 801));
와 같이 만들어놓고...

List에 추가할때...
    pDrawBitmap = new Graphics::TBitmap();
    pDrawBitmap->Width     = m_pDrawBitmap->Width;
    pDrawBitmap->Height    = m_pDrawBitmap->Height;
    pDrawBitmap->Canvas->CopyRect(m_PanRect, m_pDrawBitmap->Canvas, m_PanRect);
    m_plstDisplayBitmap->Add(pDrawBitmap);

List에서 삭제할때...
    for (int i=0; i<m_plstDisplayBitmap->Count; i++)
    {
        delete  (Graphics::TBitmap*)m_plstDisplayBitmap->Items[i]; <= 이부분에 문제가 있나요?
    }
    m_plstDisplayBitmap->Clear();
와 같이 사용하는 데 메모리에서 여러가지 문제가 발생하고 있습니다.

쉽게 프로그램 종료시 있는 다음코드를 실행시키면 오류가 발생합니다.
    if (m_plstDisplayBitmap != NULL)
    {
        for (int i=0; i<m_plstDisplayBitmap->Count; i++)
        {
            delete  (Graphics::TBitmap*)m_plstDisplayBitmap->Items[i];
        }
        m_plstDisplayBitmap->Clear();
        delete  m_plstDisplayBitmap;
        m_plstDisplayBitmap = NULL;
    }
    if (m_pDrawBitmap != NULL)
    {
        delete  m_pDrawBitmap;
        m_pDrawBitmap = NULL;
    }
고수님의 답변 부탁드립니다.

+ -

관련 글 리스트
53810 TBitmap항목을 List에 넣고 빼는 방법 조영일 1020 2008/06/30
53811     Re:TBitmap항목을 List에 넣고 빼는 방법 장성호 1394 2008/06/30
53814         답변 감사드립니다. 조영일 966 2008/06/30
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.