From faadc0e3b7563f13350117b3366a5faf1bdf26cc Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 11 Aug 2020 14:44:52 -0500 Subject: [PATCH] Still doesn't work, but at least it doesn't segfault now. --- src/backends/ns_speech_synthesizer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backends/ns_speech_synthesizer.rs b/src/backends/ns_speech_synthesizer.rs index 551db6a..fbaf3a4 100644 --- a/src/backends/ns_speech_synthesizer.rs +++ b/src/backends/ns_speech_synthesizer.rs @@ -9,7 +9,7 @@ use objc::*; use crate::{Backend, Error, Features}; -pub struct NSSpeechSynthesizerBackend(*mut Object); +pub struct NSSpeechSynthesizerBackend(*mut Object, *mut Object); impl NSSpeechSynthesizerBackend { pub fn new() -> Self { @@ -27,9 +27,9 @@ impl NSSpeechSynthesizerBackend { ) }; let delegate_class = decl.register(); - let delegate_object: Object = unsafe { msg_send![delegate_class, alloc] }; - let _: () = unsafe { msg_send![obj, setDelegate: delegate_object] }; - NSSpeechSynthesizerBackend(obj) + let delegate_obj: *mut Object = unsafe { msg_send![delegate_class, new] }; + let _: () = unsafe { msg_send![obj, setDelegate: delegate_obj] }; + NSSpeechSynthesizerBackend(obj, delegate_obj) } }