Opened 10 years ago

Closed 10 years ago

#4713 closed bug (fixed)

[Sounds] Wrong selected sounds

Reported by: mpanasyuk Owned by: marcusoverhagen
Priority: normal Milestone: R1
Component: Preferences/Sounds Version: R1/pre-alpha1
Keywords: Cc: stimut@…
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Select some sound for an event and then revert it by selecting <none> for this event. Previous sound will still be visible as selected.

Haiku R1/alpha1 (Revision 32975)

Attachments (1)

sound-preflet.diff (474 bytes ) - added by stimut 10 years ago.
Fix for Sounds preflet

Download all attachments as: .zip

Change History (4)

comment:1 by stimut, 10 years ago

Cc: stimut@… added

A bit more detail on how to produce the error:

  1. Select a file for any sound
  2. Select <none> for that same sound
  3. Select a different sound from the list of sounds
  4. Select the first sound again

At this point the list of sounds will still correctly say <none> for the sound, but the popup/drop-down (whatever it's called) will display the last selected file.

This stems from a BString's '=' operator treating a NULL 'const char *' differently to one which is an empty string. That is, the BString's value does not change if the '=' operator is used with a NULL.

I've attached a small patch which fixes the problem in the Sounds preflet. My personal preference would be to change the implementation of BString to treat NULLs like empty strings, but that is quite a core component and I don't feel I have the authority to make that call (this being my first ever code contribution) :).

by stimut, 10 years ago

Attachment: sound-preflet.diff added

Fix for Sounds preflet

in reply to:  1 comment:2 by jackburton, 10 years ago

Replying to stimut:

This stems from a BString's '=' operator treating a NULL 'const char *' differently to one which is an empty string. That is, the BString's value does not change if the '=' operator is used with a NULL.

I've attached a small patch which fixes the problem in the Sounds preflet. My personal preference would be to change the implementation of BString to treat NULLs like empty strings, but that is quite a core component and I don't feel I have the authority to make that call (this being my first ever code contribution) :).

I agree with you. If there aren't any api compatibility problems with that change, I'd like to fix that problem in BString,

comment:3 by korli, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev34983. It changes the implementation of BString as suggested and verified against Dano.

Note: See TracTickets for help on using tickets.