aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-06-29 20:09:42 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-06-29 20:09:42 +0200
commit0be11fe84b46dc189cfa642eece3b06dc1eb215d (patch)
treefd7512870f435190e6802298c1b1b2c82588d3db
parent637d751a0cd52136599162f8227312e6e45f5499 (diff)
parent8e5dec6516fa0ef1d9c50f76eeb2d60118d36802 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: .qmake.conf Change-Id: Icf1d2bf8c497f966faf8938b8eb9738849a05795
-rw-r--r--examples/macextras/embeddedqwindow/main.mm4
-rw-r--r--src/macextras/qmacfunctions_mac.mm6
2 files changed, 7 insertions, 3 deletions
diff --git a/examples/macextras/embeddedqwindow/main.mm b/examples/macextras/embeddedqwindow/main.mm
index ca1f2ff..3774a90 100644
--- a/examples/macextras/embeddedqwindow/main.mm
+++ b/examples/macextras/embeddedqwindow/main.mm
@@ -39,7 +39,7 @@
#include <qpa/qplatformnativeinterface.h>
-NSView *getEmbeddableView(QWindow *qtWindow)
+NSView *myGetEmbeddableView(QWindow *qtWindow)
{
// Make sure the platform window is created
qtWindow->create();
@@ -75,7 +75,7 @@ NSView *getEmbeddableView(QWindow *qtWindow)
// Create the QWindow and embed its view.
Window *qtWindow = new Window(); // ### who owns this window?
- NSView *qtView = getEmbeddableView(qtWindow);
+ NSView *qtView = myGetEmbeddableView(qtWindow);
[window setContentView:qtView];
// Show the NSWindow
diff --git a/src/macextras/qmacfunctions_mac.mm b/src/macextras/qmacfunctions_mac.mm
index b14c9b7..99515c1 100644
--- a/src/macextras/qmacfunctions_mac.mm
+++ b/src/macextras/qmacfunctions_mac.mm
@@ -59,10 +59,14 @@ namespace QtMac
*/
NSImage* toNSImage(const QPixmap &pixmap)
{
- NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:toCGImageRef(pixmap)];
+ if (pixmap.isNull())
+ return 0;
+ CGImageRef cgimage = toCGImageRef(pixmap);
+ NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:cgimage];
NSImage *image = [[NSImage alloc] init];
[image addRepresentation:bitmapRep];
[bitmapRep release];
+ CFRelease(cgimage);
return image;
}