X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Funicode.cpp;h=995fa10c5979f0c2224add047f8bf312fc235040;hb=8d640dc77608bedddb5b00982c23665584f52d21;hp=343b8def2be42438ad449c085e59a8af3e5fb170;hpb=6a30211fef7beda0a91966b42ecfa4631953b776;p=lyx.git diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index 343b8def2b..995fa10c59 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -52,8 +52,13 @@ namespace lyx { static const iconv_t invalid_cd = (iconv_t)(-1); -struct IconvProcessor::Impl +class IconvProcessor::Impl { +public: + // noncopyable because iconv_close() is called in destructor + Impl(Impl const &) = delete; + Impl & operator=(Impl const &) = delete; + Impl(string const & to, string const & from) : cd(invalid_cd), tocode_(to), fromcode_(from) {} @@ -61,7 +66,7 @@ struct IconvProcessor::Impl ~Impl() { if (cd != invalid_cd && iconv_close(cd) == -1) - LYXERR0("Error returned from iconv_close(" << errno << ")"); + LYXERR0("Error returned from iconv_close(" << errno << ')'); } iconv_t cd; @@ -88,10 +93,13 @@ IconvProcessor::~IconvProcessor() } -void IconvProcessor::operator=(IconvProcessor const & other) +IconvProcessor & IconvProcessor::operator=(IconvProcessor const & other) { - if (&other != this) + if (&other != this) { + delete pimpl_; pimpl_ = new Impl(other.pimpl_->tocode_, other.pimpl_->fromcode_); + } + return *this; }