If the graphics loader has a copy c-tor it should have copy assignment that does the same thing.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7112 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-06-05 22:45:51 +00:00
parent aa7c2f32e1
commit 71f798da6e
4 changed files with 20 additions and 9 deletions

View File

@ -1,6 +1,7 @@
2003-06-04 Angus Leeming <leeming@lyx.org>
* GraphicsLoader.C (Loader copy c-tor): make it work as expected. ;-)
(operator=): if it has a copy c-tor, it should have this too.
2003-06-03 Angus Leeming <leeming@lyx.org>

View File

@ -29,7 +29,7 @@ namespace grfx {
struct Loader::Impl : boost::signals::trackable {
///
Impl(Params const &);
Impl();
///
~Impl();
///
@ -67,26 +67,26 @@ private:
Loader::Loader()
: pimpl_(new Impl(Params()))
: pimpl_(new Impl)
{}
Loader::Loader(string const & file, DisplayType type)
: pimpl_(new Impl(Params()))
: pimpl_(new Impl)
{
reset(file, type);
}
Loader::Loader(string const & file, Params const & params)
: pimpl_(new Impl(Params()))
: pimpl_(new Impl)
{
reset(file, params);
}
Loader::Loader(Loader const & other)
: pimpl_(new Impl(Params()))
: pimpl_(new Impl)
{
Params const & params = other.pimpl_->params();
reset(params.filename, params);
@ -97,6 +97,16 @@ Loader::~Loader()
{}
Loader & Loader::operator=(Loader const & other)
{
if (this != &other) {
Params const & params = other.pimpl_->params();
reset(params.filename, params);
}
return *this;
}
void Loader::reset(string const & file, DisplayType type) const
{
Params params;
@ -184,8 +194,8 @@ Image const * Loader::image() const
}
Loader::Impl::Impl(Params const & params)
: status_(WaitingToLoad), params_(params)
Loader::Impl::Impl()
: status_(WaitingToLoad)
{
}

View File

@ -31,7 +31,6 @@
#include <boost/scoped_ptr.hpp>
class Inset;
class BufferView;
namespace grfx {
@ -52,6 +51,8 @@ public:
/// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
~Loader();
Loader & operator=(Loader const &);
/// The file can be changed, or the display params, or both.
void reset(string const & file_with_path,
DisplayType = ColorDisplay) const;

View File

@ -16,7 +16,6 @@
#include <boost/scoped_ptr.hpp>
class Inset;
class BufferView;
namespace grfx {