diff --git a/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp b/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp index 7b95a70dff8897e40cc99ab2c928fe1214caf939..40cddfcf53d52aef9fe86c24fd4f889988972d2a 100644 --- a/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp +++ b/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ //#define USE_VERBOSE_TRACE #include -#include #include #include #include @@ -617,7 +616,7 @@ struct OSX_DirectAudioDevice { ~OSX_DirectAudioDevice() { if (audioUnit) { - CloseComponent(audioUnit); + AudioComponentInstanceDispose(audioUnit); } if (resampler) { delete resampler; @@ -629,17 +628,16 @@ static AudioUnit CreateOutputUnit(AudioDeviceID deviceID, int isSource) { OSStatus err; AudioUnit unit; - UInt32 size; - ComponentDescription desc; + AudioComponentDescription desc; desc.componentType = kAudioUnitType_Output; desc.componentSubType = (deviceID == 0 && isSource) ? kAudioUnitSubType_DefaultOutput : kAudioUnitSubType_HALOutput; desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; - Component comp = FindNextComponent(NULL, &desc); - err = OpenAComponent(comp, &unit); + AudioComponent comp = AudioComponentFindNext(NULL, &desc); + err = AudioComponentInstanceNew(comp, &unit); if (err) { OS_ERROR0(err, "CreateOutputUnit:OpenAComponent"); @@ -664,7 +662,7 @@ static AudioUnit CreateOutputUnit(AudioDeviceID deviceID, int isSource) // get real AudioDeviceID for default input device (macosx current input device) deviceID = GetDefaultDevice(isSource); if (!deviceID) { - CloseComponent(unit); + AudioComponentInstanceDispose(unit); return NULL; } } @@ -675,7 +673,7 @@ static AudioUnit CreateOutputUnit(AudioDeviceID deviceID, int isSource) 0, &deviceID, sizeof(deviceID)); if (err) { OS_ERROR0(err, "SetProperty (CurrentDevice)"); - CloseComponent(unit); + AudioComponentInstanceDispose(unit); return NULL; } } diff --git a/src/macosx/native/sun/awt/LWCToolkit.h b/src/macosx/native/sun/awt/LWCToolkit.h index 9df44bea3b79d84f3a379d58172b1a17e7e19e68..c3e1b538ac995de5fc619893388fbc26d1e98148 100644 --- a/src/macosx/native/sun/awt/LWCToolkit.h +++ b/src/macosx/native/sun/awt/LWCToolkit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,6 @@ #import #import -#import -#import #define DEBUG 1 diff --git a/test/javax/sound/midi/Devices/InitializationHang.java b/test/javax/sound/midi/Devices/InitializationHang.java new file mode 100644 index 0000000000000000000000000000000000000000..c8e38d2d81fe34e7526fb1b71b2e5926400b0d5d --- /dev/null +++ b/test/javax/sound/midi/Devices/InitializationHang.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Toolkit; + +import javax.sound.midi.MidiSystem; + +/** + * @test + * @bug 8068412 + * @author Sergey Bylokhov + */ +public final class InitializationHang { + + public static void main(final String[] argv) throws Exception { + MidiSystem.getReceiver(); + Toolkit.getDefaultToolkit(); + } +} +