When you're not sure how something is memory managed, compiling with ARC is probably a terrible idea.
Turning magic into even-more-magic doesn't help learning. :)
GSAutocompleteWindow *window = [GSAutocompleteWindow defaultWindow];
[window displayForTextView: self];
I think I should release this window at some point. Maybe in
-dealloc or with a notification when app will close. But looking
at code in NSCoimboBoxCell.m, the GSComboWindow is not
released at some point. So, is this a memory leak? Or I don't
should worry about this. If I add a NSLog() in dealloc, this is
never called. So, I think this is a memory leak.
The method is named +defaultWindow; it does not include "alloc", "create", "new"; hence its retaincount is "+1 (-1)", which is how I denote "currently 1, but autoreleased once".
If the method name included "alloc", "create" or "new", the retaincount would be"+1 (0)", which is how I denote "currently 1, and not autoreleased".
+defaultWindow implementation should be approximately:
return [[[self alloc] initXYZ:abcd] autorelease];
If it is not autoreleased, then that's the problem.
Since it's autoreleased, I'd advise retaining the window, and later releasing it where appropriate (after the window is closed) -- despite the fact that the window might be retained while it's displayed. I don't know enough about internals of NSWindow or management of NSWindows under GNUstep to think about that... at least not yet. (GSoC will, for me, prove interesting in that regard. :))
Anyway, if -release is never called, then I'd first wonder: how do you close the window? Apple's docs for the -close method state: