VirtualBox

Changeset 30001 in vbox


Ignore:
Timestamp:
Jun 2, 2010 3:36:51 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: fix NSAutoreleaseNoPool warnings triggered from Qt

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-cocoa.mm

    r29200 r30001  
    2020
    2121#include "VBoxUtils-darwin.h"
     22#include "VBoxCocoaHelper.h"
     23
     24#include <QMenu>
    2225
    2326#include <iprt/assert.h>
     
    2932NativeWindowRef darwinToNativeWindowImpl (NativeViewRef aView)
    3033{
    31     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     34    CocoaAutoreleasePool pool;
    3235
    3336    NativeWindowRef window = NULL;
     
    3538        window = [aView window];
    3639
    37     [pool release];
    3840    return window;
    3941}
     
    4143NativeViewRef darwinToNativeViewImpl (NativeWindowRef aWindow)
    4244{
    43     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     45    CocoaAutoreleasePool pool;
    4446
    4547    NativeViewRef view = NULL;
     
    4749        view = [aWindow contentView];
    4850
    49     [pool release];
    5051    return view;
    5152}
     
    5354void darwinSetShowsToolbarButtonImpl (NativeWindowRef aWindow, bool aEnabled)
    5455{
    55     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     56    CocoaAutoreleasePool pool;
    5657
    5758    [aWindow setShowsToolbarButton:aEnabled];
    58 
    59     [pool release];
    6059}
    6160
    6261void darwinSetShowsResizeIndicatorImpl (NativeWindowRef aWindow, bool aEnabled)
    6362{
    64     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     63    CocoaAutoreleasePool pool;
    6564
    6665    [aWindow setShowsResizeIndicator:aEnabled];
    67 
    68     [pool release];
    6966}
    7067
    7168void darwinSetHidesAllTitleButtonsImpl (NativeWindowRef aWindow)
    7269{
    73     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     70    CocoaAutoreleasePool pool;
    7471
    7572    /* Remove all title buttons by changing the style mask. This method is
     
    9592            [pButton setEnabled: NO];
    9693    }
    97 
    98     [pool release];
    9994}
    10095
    10196void darwinSetShowsWindowTransparentImpl (NativeWindowRef aWindow, bool aEnabled)
    10297{
    103     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     98    CocoaAutoreleasePool pool;
    10499
    105100    if (aEnabled)
     
    115110        [aWindow setHasShadow:YES];
    116111    }
     112}
    117113
    118     [pool release];
     114void darwinSetDockIconMenu(QMenu* pMenu)
     115{
     116    CocoaAutoreleasePool pool;
     117
     118    extern void qt_mac_set_dock_menu(QMenu *);
     119    qt_mac_set_dock_menu(pMenu);
    119120}
    120121
     
    126127void darwinSetMouseCoalescingEnabled (bool aEnabled)
    127128{
    128     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     129    CocoaAutoreleasePool pool;
    129130
    130131    [NSEvent setMouseCoalescingEnabled:aEnabled];
    131 
    132     [pool release];
    133132}
    134133
    135134void darwinWindowAnimateResizeImpl (NativeWindowRef aWindow, int x, int y, int width, int height)
    136135{
    137     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     136    CocoaAutoreleasePool pool;
    138137
    139138    /* It seems that Qt doesn't return the height of the window with the
     
    151150
    152151    [aWindow setFrame:windowFrame display:YES animate:YES];
    153 
    154     [pool release];
    155152}
    156153
    157154void darwinWindowInvalidateShadowImpl (NativeWindowRef aWindow)
    158155{
    159     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     156    CocoaAutoreleasePool pool;
    160157
    161158    [aWindow invalidateShadow];
    162 
    163     [pool release];
    164159}
    165160
    166161int darwinWindowToolBarHeight (NativeWindowRef aWindow)
    167162{
    168     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     163    CocoaAutoreleasePool pool;
    169164
    170165    NSToolbar *toolbar = [aWindow toolbar];
     
    177172        toolbarHeight = NSHeight (windowFrame) - NSHeight ([[aWindow contentView] frame]) - theight;
    178173
    179     [pool release];
    180174    return toolbarHeight;
    181175}
     
    183177bool darwinIsWindowMaximized(NativeWindowRef aWindow)
    184178{
    185     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     179    CocoaAutoreleasePool pool;
    186180
    187181    bool fResult = [aWindow isZoomed];
    188182
    189     [pool release];
    190183    return fResult;
    191184}
     
    193186float darwinSmallFontSize()
    194187{
    195     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     188    CocoaAutoreleasePool pool;
    196189
    197190    float size = [NSFont systemFontSizeForControlSize: NSSmallControlSize];
    198191
    199     [pool release];
    200192    return size;
    201193}
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.h

    r29812 r30001  
    4343class QPixmap;
    4444class QImage;
     45class QMenu;
    4546
    4647# ifdef QT_MAC_USE_COCOA
     
    154155void darwinSetHidesAllTitleButtons(QWidget *aWidget);
    155156void darwinSetShowsWindowTransparent(QWidget *aWidget, bool aEnabled);
     157void darwinSetDockIconMenu(QMenu *pMenu);
    156158void darwinDisableIconsInMenus(void);
    157159
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r29915 r30001  
    598598
    599599    /* Add it to the dock. */
    600     extern void qt_mac_set_dock_menu(QMenu *);
    601     qt_mac_set_dock_menu(pDockMenu);
     600    ::darwinSetDockIconMenu(pDockMenu);
    602601
    603602    /* Now the dock icon preview */
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