Forums » Discussion »
openDialogForType behaves strangely in a release build
Added by JongAm Park almost 2 years ago
I noticed that it doesn't add openFileSettings, binarySelectionview and file browser part.
However, in a debug build it works without any problem. It happens with a release build.
openPanel = [NSOpenPanel openPanel];
NSString *theFile = nil;
NSString *defDir;
if (!(defDir = [[self preferences] objectForKey:MPEDefaultDirectory]))
defDir = NSHomeDirectory();
[openPanel setAllowsMultipleSelection:NO];
[openPanel setDelegate:self];
[openPanel setAllowedFileTypes:typeList];
// show additional options based on type
if (type == MP_DIALOG_MEDIA || type == MP_DIALOG_VIDEO) {
NSView *options = [[[NSView alloc] initWithFrame:NSZeroRect] autorelease];
[options addSubview:openFileSettings];
[options addSubview:[preferencesController binarySelectionView]];
[options resizeAndArrangeSubviewsVerticallyWithPadding:5];
[openPanel setAccessoryView:options];
I suspected that options is released quickly in release build.
I also tried retain/release mechanism, instead of autorelease. Because setAccessroyView retains options, you can release the options in the next line of the setAccessoryView, if you remove the "autorelease" message.
However, it still doesn't display the sub views including the file browser part.
Have any idea? ( I used PowerPC 17" iMac with Mac OS X 10.5. Xcode 3.1.4 )