nsISound::Play(aSoundURL) not working except in one weird case

RESOLVED INVALID

Status

()

--
blocker
RESOLVED INVALID
16 years ago
14 years ago

People

(Reporter: aaronlev, Assigned: pavlov)

Tracking

Trunk
x86
Windows 2000
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

16 years ago
I can't add a custom .wav file to typeaheadfind, because
nsISound::Play(aSoundURL) is not working.

The strange thing is, I can get it to work if I use the debugger, trace into
this one line of code and step over it.
  BOOL PlaySound(const char *aSoundFile,HMODULE aModule,DWORD aOptions) {
    return (mPlay) ? mPlay(aSoundFile, aModule, aOptions) : FALSE;
  }

If I just let it run normally the sound won't play, either in the debug or
release builds.
(Reporter)

Updated

16 years ago
Blocks: 30088, 176602
Severity: normal → blocker
(Reporter)

Comment 1

16 years ago
This stinks, I want my custom sound. Someone gimme a clue to what's going on
here? Something to do with threads?
(Reporter)

Comment 2

16 years ago
Okay, I figured out what was going wrong. I was using:
nsCOMPtr<nsISound> soundInterface = do_CreateInstance("@mozilla.org/sound;1");

The problem with this is that nsISound::Play() uses OnStreamComplete() to play
the sound, which might not be called before the com pointer goes out of scope,
and thus the destructor gets called before the sound has a chance to get played.
(Reporter)

Comment 3

16 years ago
The caller just needs to make sure their COMPtr doesn't go out of scope too soon.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → INVALID

Updated

14 years ago
Component: XP Miscellany → XP Toolkit/Widgets
You need to log in before you can comment on or make changes to this bug.