ardour/libs/pbd/locale_guard.cc
Paul Davis 14b0ca31bc handle deletion of UI objects between the time that a callback is queued with the UI event loop and the execution of the callback (intrusive, big)
git-svn-id: svn://localhost/ardour2/branches/3.0@6807 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-03-30 15:18:43 +00:00

29 lines
506 B
C++

#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include "pbd/locale_guard.h"
using namespace PBD;
LocaleGuard::LocaleGuard (const char* str)
{
old = setlocale (LC_NUMERIC, NULL);
if (old) {
old = strdup (old);
if (strcmp (old, str)) {
setlocale (LC_NUMERIC, str);
}
}
}
LocaleGuard::~LocaleGuard ()
{
setlocale (LC_NUMERIC, old);
if (old) {
free ((char*)old);
}
}