Skip to content
  • Philip Withnall's avatar
    gutils: Don’t read directory globals outside the lock · b87dfb49
    Philip Withnall authored
    
    
    While it is currently OK to read the global variables backing functions
    like g_get_user_data_dir() without the g_utils_global lock held (since
    such a read is always preceeded by a critical section where the variable
    is set to its final value), upcoming changes will allow those variables
    to be changed. If they are changed from one thread while another thread
    is calling (for example) g_get_user_data_dir(), the final read from the
    second thread could race with the first thread.
    
    Avoid that by only reading the global variables with the lock held.
    
    Signed-off-by: default avatarPhilip Withnall <withnall@endlessm.com>
    
    #538
    b87dfb49