summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp67
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp5
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp5
3 files changed, 43 insertions, 34 deletions
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 689f1f462d..45d62e797f 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -331,55 +331,57 @@ bool AudioDriverCoreAudio::try_lock() {
}
void AudioDriverCoreAudio::finish() {
- OSStatus result;
+ if (audio_unit) {
+ OSStatus result;
- lock();
+ lock();
- AURenderCallbackStruct callback;
- zeromem(&callback, sizeof(AURenderCallbackStruct));
- result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
- if (result != noErr) {
- ERR_PRINT("AudioUnitSetProperty failed");
- }
-
- if (active) {
- result = AudioOutputUnitStop(audio_unit);
+ AURenderCallbackStruct callback;
+ zeromem(&callback, sizeof(AURenderCallbackStruct));
+ result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
if (result != noErr) {
- ERR_PRINT("AudioOutputUnitStop failed");
+ ERR_PRINT("AudioUnitSetProperty failed");
}
- active = false;
- }
+ if (active) {
+ result = AudioOutputUnitStop(audio_unit);
+ if (result != noErr) {
+ ERR_PRINT("AudioOutputUnitStop failed");
+ }
- result = AudioUnitUninitialize(audio_unit);
- if (result != noErr) {
- ERR_PRINT("AudioUnitUninitialize failed");
- }
+ active = false;
+ }
+
+ result = AudioUnitUninitialize(audio_unit);
+ if (result != noErr) {
+ ERR_PRINT("AudioUnitUninitialize failed");
+ }
#ifdef OSX_ENABLED
- AudioObjectPropertyAddress prop;
- prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
- prop.mScope = kAudioObjectPropertyScopeGlobal;
- prop.mElement = kAudioObjectPropertyElementMaster;
+ AudioObjectPropertyAddress prop;
+ prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
+ prop.mScope = kAudioObjectPropertyScopeGlobal;
+ prop.mElement = kAudioObjectPropertyElementMaster;
- result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
- if (result != noErr) {
- ERR_PRINT("AudioObjectRemovePropertyListener failed");
- }
+ result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
+ if (result != noErr) {
+ ERR_PRINT("AudioObjectRemovePropertyListener failed");
+ }
#endif
- result = AudioComponentInstanceDispose(audio_unit);
- if (result != noErr) {
- ERR_PRINT("AudioComponentInstanceDispose failed");
- }
+ result = AudioComponentInstanceDispose(audio_unit);
+ if (result != noErr) {
+ ERR_PRINT("AudioComponentInstanceDispose failed");
+ }
- unlock();
+ unlock();
+ }
if (mutex) {
memdelete(mutex);
mutex = NULL;
}
-};
+}
Error AudioDriverCoreAudio::capture_start() {
@@ -576,6 +578,7 @@ String AudioDriverCoreAudio::capture_get_device() {
#endif
AudioDriverCoreAudio::AudioDriverCoreAudio() {
+ audio_unit = NULL;
active = false;
mutex = NULL;
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index eebdbe9493..88f14890ef 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1008,7 +1008,10 @@ RID RasterizerSceneGLES3::light_instance_create(RID p_light) {
light_instance->light = p_light;
light_instance->light_ptr = storage->light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light_instance->light_ptr, RID());
+ if (!light_instance->light_ptr) {
+ memdelete(light_instance);
+ ERR_FAIL_COND_V(!light_instance->light_ptr, RID());
+ }
light_instance->self = light_instance_owner.make_rid(light_instance);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 8ae6040aed..5ee6c28d83 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -7011,7 +7011,10 @@ RID RasterizerStorageGLES3::canvas_light_shadow_buffer_create(int p_width) {
//printf("errnum: %x\n",status);
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
- ERR_FAIL_COND_V(status != GL_FRAMEBUFFER_COMPLETE, RID());
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ memdelete(cls);
+ ERR_FAIL_COND_V(status != GL_FRAMEBUFFER_COMPLETE, RID());
+ }
return canvas_light_shadow_owner.make_rid(cls);
}