Home › Forums › OpenEars plugins › Malloc_error when changing views in UINavigationController
Tagged: neatspeech error malloc
- This topic has 18 replies, 2 voices, and was last updated 10 years, 7 months ago by Halle Winkler.
-
AuthorPosts
-
September 24, 2013 at 1:44 am #1018389tbeagleyParticipant
After speech has been instantiated if I attempt to change view controllers the app crashes. If speech is not instantiated I am able to freely move between view controllers.
Only one of the view controllers uses flite/neatspeech. I am able to start and stop speech using the code contained in the guide that came along with my order. There are no current issues if I remain in the view controller that contains the speech code.
Is there something I need to do in order to deallocate or free flite/neatspeech when switching between view controllers?
error is:
malloc: *** error for object 0x210535c0: pointer being freed was not allocated
This is in Xcode 5 using ARC.
September 24, 2013 at 7:13 am #1018393Halle WinklerPolitepixWelcome,
This could be a bug in 1.5, but first I wanted to ask whether you are sending a [self.fliteController stopSpeaking]; message before exiting the view controller.
September 24, 2013 at 3:36 pm #1018396tbeagleyParticipantYes, every button that takes the user away from the page of spoken contents sends that message, including when the view is changed.
I see that the command is obeyed (the speech stops) but as soon as the view controller unloads I get the error. Setting the break point in malloc_error_break doesn’t tell me much (I’m a bit new to Xcode and ObjC)
How do you typically handle having flite/openears in a navigation project with multiple views? Would you import everything into the AppDelegate files (or some other files) and reference from there? Or should it “just work” when resources are de or reallocated from one view to another view?
September 24, 2013 at 3:48 pm #1018397Halle WinklerPolitepixIn the case of PocketsphinxController it has to be a single instantiation and is designed to be able to deliver info to any part of the app using OpenEarsEventsObserver so it should go in the root view controller and stay there IMO (very little should go in your AppDelegate).
In the case of FliteController it isn’t intended to be restricted to a single root view controller so I consider this buggy behavior. I think you can work around it for now by treating it in the same way as PocketsphinxController but I am going to look into what is going on with that tomorrow and get back to you because it ought to be able to deallocate if it is stopped properly. Can you share with me the device and OS version for testing?
Yes, every button that takes the user away from the page of spoken contents sends that message, including when the view is changed.
Can I see a snippet of the button-activated code?
September 24, 2013 at 3:55 pm #1018398tbeagleyParticipantI was really hoping to push this out today. I didn’t realize you were in Germany.
Here’s one of the buttons that would stop speech:
- (IBAction)btnBrowse:(id)sender { [self.fliteController stopSpeaking]; //go back to a url where we get some data from JSON NSString *website = [NSString stringWithFormat:@"...some URL"]; NSURL *url = [NSURL URLWithString:website]; NSURLRequest *requestURL = [NSURLRequest requestWithURL:url]; [webBoxPDF01 loadRequest:requestURL]; }
that stops the speech, but when I exit that view using the navigation controller’s back button it crashes.
And I’ve even taken to adding this to my .mm file for the view that uses fliteController:
- (void)dealloc { [self.fliteController stopSpeaking]; }
The voice stops speaking, but again, the app crashes.
September 24, 2013 at 4:02 pm #1018401tbeagleyParticipantDevice is an iPhone 4s and OS is 6.1.3 (most of the users in my company disregard os upgrades, so I’ll need to support 6.x for a while)
The issue also occurs on a 4s running iOS 7 and in the emulators running both versions.
September 24, 2013 at 4:05 pm #1018402tbeagleyParticipantNot sure if it helps, but here’s the code where the speech is triggered:
//labels from JSON data for visual and audio NSString *readLabels = [NSString stringWithFormat:@"%@%@%@",self.lblRead1.text,self.lblRead2.text,self.lblRead3.text]; //some lazy code based on the user's voice prefs (male or female) if ([voiceIsSet isEqualToString:voiceIsEmma]) { [self.fliteController sayWithNeatSpeech:readLabels withVoice:self.ealt]; } else { [self.fliteController sayWithNeatSpeech:readLabels withVoice:self.william]; }
September 24, 2013 at 4:14 pm #1018403Halle WinklerPolitepixHi tbeagley,
I’m sorry for the issue. Since this is a bug it will require a plugin update to fix, so even if I were in the same timezone as you I wouldn’t be able to find the issue, fix it, test the fix and push the update quickly enough for you to publish today, but I understand that you have time pressure and that this is a blocker. It is now the top priority and I’ll have more info for you tomorrow.
I expect that a workaround that will work right now would be to keep it in a root level view controller and message it from child view controllers with delegate methods or notifications to control the speech.
September 24, 2013 at 4:17 pm #1018404Halle WinklerPolitepixThanks for following up with more code. When you get the crash, what happens if you type “bt” into the blue llvm prompt in the debug console?
September 24, 2013 at 4:17 pm #1018405tbeagleyParticipantThanks for the quick replies, Halle. I appreciate the time you’ve given me.
I’ll attempt the workaround for now and I look forward to your updates.
September 24, 2013 at 4:21 pm #1018407Halle WinklerPolitepixNo problem at all, definitely don’t want any crashes so I’m glad to be alerted. I’ll follow up soon.
September 24, 2013 at 4:23 pm #1018409Halle WinklerPolitepixThat’s a helpful backtrace, thanks. I’ve saved it and removed it from the post.
September 25, 2013 at 3:42 pm #1018416tbeagleyParticipantJust checking in, any new info?
September 25, 2013 at 3:47 pm #1018417Halle WinklerPolitepixI’ve removed the source of the crash but there is now a leak, so I’m investigating the leak. No worries, I’m not going to forget to follow up with you.
September 25, 2013 at 3:51 pm #1018418tbeagleyParticipantGreat to hear, thanks a ton.
September 25, 2013 at 5:30 pm #1018419Halle WinklerPolitepixOK, I just sent you an email with a link to a version to check out — let me know how it’s working for you.
September 25, 2013 at 5:31 pm #1018420tbeagleyParticipantI’ll let you know right away.
September 25, 2013 at 5:58 pm #1018421tbeagleyParticipantWorks like a charm, Halle.
Thanks for the amazing response!
I have another unrelated question, is it better to just start a new thread? (regarding word pronunciation and dictionaries)
September 25, 2013 at 6:00 pm #1018422Halle WinklerPolitepixGreat to hear it — you’re welcome, and thanks for helpful info about the issue. Yes, it’s probably better to start a new thread because then I can point other forum users to it if it comes up again.
-
AuthorPosts
- You must be logged in to reply to this topic.