Avoid extra if tests now that Associate/Disassociate do the test themselves
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21945
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/app.h"
#endif //WX_PRECOMP
#include "wx/app.h"
#endif //WX_PRECOMP
+#import <AppKit/NSView.h>
#import <AppKit/NSWindow.h>
// ----------------------------------------------------------------------------
// globals
#import <AppKit/NSWindow.h>
// ----------------------------------------------------------------------------
// globals
wxTopLevelWindowCocoa::~wxTopLevelWindowCocoa()
{
wxTopLevelWindowCocoa::~wxTopLevelWindowCocoa()
{
+ // Hand ownership of the content view to wxWindow so it can destroy
+ // itself properly.
+ NSView *view = [m_cocoaNSView retain];
+ SetNSView(view);
+ [view release];
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
{
bool need_debug = cocoaNSWindow || m_cocoaNSWindow;
if(need_debug) wxLogDebug("wxTopLevelWindowCocoa=%p::SetNSWindow [m_cocoaNSWindow=%p retainCount]=%d",this,m_cocoaNSWindow,[m_cocoaNSWindow retainCount]);
{
bool need_debug = cocoaNSWindow || m_cocoaNSWindow;
if(need_debug) wxLogDebug("wxTopLevelWindowCocoa=%p::SetNSWindow [m_cocoaNSWindow=%p retainCount]=%d",this,m_cocoaNSWindow,[m_cocoaNSWindow retainCount]);
- if(m_cocoaNSWindow)
- DisassociateNSWindow(m_cocoaNSWindow);
+ DisassociateNSWindow(m_cocoaNSWindow);
[cocoaNSWindow retain];
[m_cocoaNSWindow release];
m_cocoaNSWindow = cocoaNSWindow;
[cocoaNSWindow retain];
[m_cocoaNSWindow release];
m_cocoaNSWindow = cocoaNSWindow;
SetNSView([m_cocoaNSWindow contentView]);
else
SetNSView(NULL);
SetNSView([m_cocoaNSWindow contentView]);
else
SetNSView(NULL);
- if(m_cocoaNSWindow)
- AssociateNSWindow(m_cocoaNSWindow);
+ AssociateNSWindow(m_cocoaNSWindow);
if(need_debug) wxLogDebug("wxTopLevelWindowCocoa=%p::SetNSWindow [cocoaNSWindow=%p retainCount]=%d",this,cocoaNSWindow,[cocoaNSWindow retainCount]);
}
if(need_debug) wxLogDebug("wxTopLevelWindowCocoa=%p::SetNSWindow [cocoaNSWindow=%p retainCount]=%d",this,cocoaNSWindow,[cocoaNSWindow retainCount]);
}