osx - Custom file owner of a nib file leaks in OS X / Swift -


i need class, call document, file owner of nib containing user interface (just document: nsdocument file owner in apple's document-based template). likewise, not want document inherit nswindowcontroller, manage instance of load nib , set document file owner:

let windowcontroller = nswindowcontroller(windownibname: "documentwindow", owner: self) 

sounds simple, yet unable file owner deallocate along other nib objects. reason that, according apple, "for historical reasons, in os x top-level objects in nib file created additional reference count." (see: top-level objects in os x may need special handling)

if set window's isreleasedwhenclosed true , set property nil, deinit called. instance of nswindowcontroller... instance of document, file owner, remains! it's deinit never called.

if set file owner window controller, deallocates fine, including document instance, setup difficult subclass, need... need document instance file owner.

and so, case, documentation suggests following:

if file’s owner not instance of nswindowcontroller or nsviewcontroller, need decrement reference count of top level objects yourself. must cast references top-level objects core foundation type , use cfrelease.

but how can in swift?

would grateful insight , suggestions!


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -