Make IconvProcessor::Impl noncopyable

The compiler-generated copy-constructor and assigment operators would be wrong
for IconvProcessor::Impl, since cd would be copied, and iconv_close() could
thus be called twice on the same descriptor. The old code did work, but now
IconvProcessor::Impl cannot be copied by accident in the future.
This commit is contained in:
Georg Baum 2014-07-01 22:23:06 +02:00
parent 0e8fea0705
commit c9c20dc23b
2 changed files with 6 additions and 2 deletions

View File

@ -52,8 +52,12 @@ namespace lyx {
static const iconv_t invalid_cd = (iconv_t)(-1);
struct IconvProcessor::Impl
class IconvProcessor::Impl
{
// noncopyable because iconv_close() is called in destructor
Impl(Impl const &);
Impl & operator=(Impl const &);
public:
Impl(string const & to, string const & from)
: cd(invalid_cd), tocode_(to), fromcode_(from)
{}

View File

@ -68,7 +68,7 @@ private:
/// \return true if the processor is ready to use.
bool init();
/// hide internals
struct Impl;
class Impl;
Impl * pimpl_;
};