[Development] QMacCocoaViewContainer changes?

Philippe philwave at gmail.com
Fri Feb 17 09:28:28 CET 2017


I observed some change too. In my case, a NSView, created on the client
side ("my side"), and inserted inside a Qt hierarchy, is now released
automatically by Qt.
Before, I had to release this NSView "manually". When switching to Qt
5.8, the NSView was released twice (client + Qt sides), causing a crash
in OSX code.

Simply not releasing the NSView on the client side, is enough
(apparently so far), to solve the problem.

I did not report a bug, because this looks more like a behavior change 
(not documented), than a bug.

Philippe

On Thu, 16 Feb 2017 23:21:52 +0100
René J.V. Bertin <rjvbertin at gmail.com> wrote:

> Hello,
> 
> Has anything changed in Qt 5.8.0 with the way the QMacCocoaViewContainer class has to be used? I observe the following after updating from 5.7.1 to 5.8.0 :
> 
> - Qt Designer crashes when I have Phonon 4.9.x installed with the phonon-backend-vlc git/master backend (https://cgit.kde.org/phonon-vlc.git/). 
> - the QMacCocoaViewContainer ctor now also calls QMacCocoaViewContainer::setCocoaView() when a NULL NSView pointer is given.
> - the QMacCocoaViewContainer example no longer releases the native view after passing it to setCocoaView(), despite what the documentation says, and despite the fact that setCocoaView indeed does a retain. Not releasing the VideoView instance in phonon-vlc's VlcMacWidget ctor also prevents the Designer crash but theoretically means the instance is being leaked.
> 
> The Designer crash is preceded by the terminal output below and occurs in ~QMacCocoaViewContainer(), when doing [nsview release]. This means it's doing one release too many, as confirmed by the malloc error.
> qt.qpa.cocoa.window: NSView is not QNSView, consider checking for Qt::ForeignWindow
> qt.qpa.cocoa.window: NSView is not QNSView, consider checking for Qt::ForeignWindow
> Designer(97879,0x7fff721fd310) malloc: *** error for object 0x7fc7cf2a3300: pointer being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> 
> 
> Thanks,
> R.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development





More information about the Development mailing list