Prevent crash when using an unknown locale (#692049)

When GParted is run with a locale the OS doesn't know it crashes.
Reapply original fix.

    # LANG=xx_XX.UTF-8 ~mike/bin/gpartedbin

    (process:20385): Gtk-WARNING **: Locale not supported by C library.
            Using the fallback 'C' locale.
    ======================
    libparted : 3.1
    ======================

    (gpartedbin:20385): glibmm-ERROR **:
    unhandled exception (type std::exception) in signal handler:
    what: locale::facet::_S_create_c_locale name not valid

    Trace/breakpoint trap (core dumped)

Original bug:
    Bug #157871 - gparted 0.0.6 segfaults on start
First fix:
    commit a98126d69b
    quick 'fix' for crashers in some locales (#157871) basicly the same +
Accidentally reintroduced by:
    commit a739afc9a1
    Update String::ucompose library to version 1.0.5

Bug #692049 - Troubles with some locales
This commit is contained in:
Mike Fleetwood 2013-01-20 01:04:59 +00:00 committed by Curtis Gedak
parent 90337f157a
commit 75eba94a6c
1 changed files with 2 additions and 1 deletions

View File

@ -186,7 +186,8 @@ namespace UStringPrivate
: arg_no(1)
{
#if __GNUC__ >= 3
os.imbue(std::locale("")); // use the user's locale for the stream
//Prevent crash with unknown locales. See bugs #157871, #692049
//os.imbue(std::locale("")); // use the user's locale for the stream
#endif
std::string::size_type b = 0, i = 0;