[haiku-bugs] Re: [Haiku] #4713: [Sounds] Wrong selected sounds

#4713: [Sounds] Wrong selected sounds
--------------------------------+-------------------------------------------
 Reporter:  mpanasyuk           |       Owner:  marcusoverhagen
     Type:  bug                 |      Status:  new            
 Priority:  normal              |   Milestone:  R1             
Component:  Preferences/Sounds  |     Version:  R1/pre-alpha1  
 Keywords:                      |   Blockedby:                 
 Platform:  All                 |    Blocking:                 
--------------------------------+-------------------------------------------
Changes (by stimut):

 * cc: stimut@… (added)


Comment:

 A bit more detail on how to produce the error:

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

 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) :).

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/4713#comment:1>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: