Thanks Jens. On the other hand now runModalForWindow increases retainCount! Why is that? > It makes no sense to me. > > > It’s probably being retained and then autoreleased by AppKit. Don’t pay > any attention to retainCount, it’s generally not useful for detecting > memory issues. > > However, note that you called -alloc to create the NSWindow, so by the > memory guidelines you are responsible for releasing it when you’re through > with it. >
But the retainCount is needed for successful release of the window, right? I allocate the window and then deallocate it when I'm finished with it. But runModalForWindow increases retainCount to 2, so when I release it, it's actually not destroyed and causes a crash afterward, because for some crazy reason the OS tries to repaint the view in it, despite the window is already closed... > > > Also the window still appears in background (code below) and cursor cannot > be changed. > > > What app is this in? Is it a Carbon app? I’ve never done Cocoa-in-Carbon > embedding but I think there may be some special considerations involved. > No no, I do it only because Apple discarded Carbon for 64bit apps. But the app/plugin is all C++, so there should just be a small layer, that does what Carbon does normally... ugly world of development for Apple... > NSUInteger style = NSBorderlessWindowMask; > > > Borderless windows can’t get keyboard focus by default. If you want that > you’ll have to subclass NSWindow and override -canBecomeKey. > > Also, running a borderless window as modal is kind of weird and probably > contrary to the HI Guidelines. Is there a good reason this needs to not > have a title bar? > I'm using my own styles. It may be no according to HI guidelines, but to be honest, I don't care. The app/plugin should look the same on all platforms. > NSString *titlens = MStringToNSString(caption); > [desc->Window setTitle: titlens ]; > [titlens release]; > > > This seems sort of weird — your MStringToNSString doesn’t return an > autoreleased NSString? That’s against refcounting conventions and rather > error-prone. > Yaj, ok, can you explain a little more? I don't know much about Objective C, how should the MStringToNSString be implemented to create the autoreleased NSString? (sorry for lack of knowledge, but I just don't plan any further development in objc, just want the small layer...) Vojtech _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com