VirtualBox

Changeset 23796 in vbox


Ignore:
Timestamp:
Oct 15, 2009 12:41:14 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: fix memory leaks in drawing code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp

    r19817 r23796  
    5252{
    5353    Log (("Quartz2D: Creating\n"));
    54     resizeEvent (new VBoxResizeEvent (FramebufferPixelFormat_Opaque,
    55                                       NULL, 0, 0, 640, 480));
     54
     55    VBoxResizeEvent event(FramebufferPixelFormat_Opaque,
     56                          NULL, 0, 0, 640, 480);
     57    resizeEvent (&event);
    5658}
    5759
     
    179181        CGImageRef subImage;
    180182        if (!mView->pauseShot().isNull())
    181             subImage = CGImageCreateWithImageInRect (::darwinToCGImageRef (&mView->pauseShot()), CGRectMake (mView->contentsX(), mView->contentsY(), mView->visibleWidth(), mView->visibleHeight()));
     183        {
     184            CGImageRef pauseImg = ::darwinToCGImageRef (&mView->pauseShot());
     185            subImage = CGImageCreateWithImageInRect (pauseImg, CGRectMake (mView->contentsX(), mView->contentsY(), mView->visibleWidth(), mView->visibleHeight()));
     186            CGImageRelease (pauseImg);
     187        }
    182188        else
    183189            subImage = CGImageCreateWithImageInRect (mImage, CGRectMake (mView->contentsX(), mView->contentsY(), mView->visibleWidth(), mView->visibleHeight()));
     
    215221        CGContextEndTransparencyLayer (ctx);
    216222#endif
     223        CGImageRelease (subImage);
    217224    }
    218225    else
     
    226233        CGImageRef subImage;
    227234        if (!mView->pauseShot().isNull())
    228             subImage = CGImageCreateWithImageInRect (::darwinToCGImageRef (&mView->pauseShot()), ::darwinToCGRect (is));
     235        {
     236            CGImageRef pauseImg = ::darwinToCGImageRef (&mView->pauseShot());
     237            subImage = CGImageCreateWithImageInRect (pauseImg, ::darwinToCGRect (is));
     238            CGImageRelease (pauseImg);
     239        }
    229240        else
    230241            subImage = CGImageCreateWithImageInRect (mImage, ::darwinToCGRect (is));
     
    247258        /* At this point draw the real vm image */
    248259        CGContextDrawImage (ctx, ::darwinFlipCGRect (::darwinToCGRect (ir), viewRect.size.height), subImage);
     260
     261        CGImageRelease (subImage);
    249262    }
    250263}
     
    276289    {
    277290//        printf ("VRAM\n");
    278         CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
    279291        /* Create the image copy of the framebuffer */
    280292        CGDataProviderRef dp = CGDataProviderCreateWithData (NULL, aEvent->VRAM(), aEvent->bitsPerPixel() / 8 * mWdt * mHgt, NULL);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette