You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2014/02/11 00:23:51 UTC

[jira] [Commented] (CB-4755) Crash in Media.setVolume

    [ https://issues.apache.org/jira/browse/CB-4755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13897253#comment-13897253 ] 

ASF subversion and git services commented on CB-4755:
-----------------------------------------------------

Commit a8cd8f9925c82ebb90b9a75474d1259a79608963 in branch refs/heads/master from [~hansmi]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;h=a8cd8f9 ]

[CB-4755] Fix crash in Media.setVolume on iOS

Media.setVolume caused the application to crash after Media.release was
called. Code causing crash:

  var m = new Media("test.caf");
  m.release();
  m.setVolume(1); // crash in this call

The reason was that retrieving the CDVAudioFile instance from the sound
cache would return nil after Media.release. This patch fixes the issue
by explicitely checking for nil. It also does away with an unnecessary
cache initialization, which isn't needed as -[Media setVolume:] doesn't
write to the cache.

Signed-off-by: Michael Hanselmann <pu...@hansmi.ch>


> Crash in Media.setVolume
> ------------------------
>
>                 Key: CB-4755
>                 URL: https://issues.apache.org/jira/browse/CB-4755
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS, Plugin Media
>    Affects Versions: 2.7.0, 3.0.0
>         Environment: Mac OS X 10.8.4, developing for iOS using Xcode 4.6.3
>            Reporter: Michael Hanselmann
>            Assignee: Shazron Abdullah
>            Priority: Critical
>             Fix For: 3.4.0
>
>
> Media.setVolume causes the application to crash after Media.release was called:
> {code}
> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: 6df28c63-6f6b-29e5-b12f-09189833dbbd)'
> *** First throw call stack:
> ([…])
> libc++abi.dylib: terminate called throwing an exception
> {code}
> Reproduced using Cordova 2.7.0 and 3.0.9:
> {code}
> $ cordova -v
> 3.0.9
> {code}
> Code causing crash:
> {code}
> var m = new Media("test.caf");
> m.release();
> m.setVolume(1); // crash in this call
> {code}
> This works:
> {code}
> var m = new Media("test.caf");
> m.release();
> m.play();
> m.setVolume(1);
> {code}
> When I look at {{-[Media setVolume:]}} I get the impression that it's unfinished in general. If {{soundCache}} is nil it creates a cache, but doesn't do anything else.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)