diff --git a/toonz/sources/common/expressions/texpression.cpp b/toonz/sources/common/expressions/texpression.cpp index 04f9303..f8d395d 100644 --- a/toonz/sources/common/expressions/texpression.cpp +++ b/toonz/sources/common/expressions/texpression.cpp @@ -46,7 +46,6 @@ TExpression::TExpression() TExpression::~TExpression() { - delete m_imp; } //-------------------------------------------------------------------------- diff --git a/toonz/sources/common/expressions/tgrammar.cpp b/toonz/sources/common/expressions/tgrammar.cpp index 6d5de6b..f0d05bd 100644 --- a/toonz/sources/common/expressions/tgrammar.cpp +++ b/toonz/sources/common/expressions/tgrammar.cpp @@ -1319,7 +1319,6 @@ Grammar::Grammar() Grammar::~Grammar() { - delete m_imp; } void Grammar::addPattern(Pattern *pattern) diff --git a/toonz/sources/common/expressions/tparser.cpp b/toonz/sources/common/expressions/tparser.cpp index aecc98d..17140e4 100644 --- a/toonz/sources/common/expressions/tparser.cpp +++ b/toonz/sources/common/expressions/tparser.cpp @@ -92,7 +92,6 @@ Parser::Parser(const Grammar *grammar) Parser::~Parser() { - delete m_imp; } //------------------------------------------------------------------- diff --git a/toonz/sources/common/tapptools/tcli.cpp b/toonz/sources/common/tapptools/tcli.cpp index b73519c..baac4c5 100644 --- a/toonz/sources/common/tapptools/tcli.cpp +++ b/toonz/sources/common/tapptools/tcli.cpp @@ -785,13 +785,12 @@ void UsageImp::resetValues() //--------------------------------------------------------- Usage::Usage(string progName) + : m_imp(new UsageImp(progName)) { - m_imp = new UsageImp(progName); } Usage::~Usage() { - delete m_imp; } void Usage::add(const UsageLine &ul) diff --git a/toonz/sources/common/tapptools/ttimer.cpp b/toonz/sources/common/tapptools/ttimer.cpp index 8c7289c..0e631ee 100644 --- a/toonz/sources/common/tapptools/ttimer.cpp +++ b/toonz/sources/common/tapptools/ttimer.cpp @@ -292,15 +292,14 @@ public: //=============================================================================== TTimer::TTimer(const string &name, UINT timerRes, Type type) + : m_imp(new TTimer::Imp(name, timerRes, type, this)) { - m_imp = new TTimer::Imp(name, timerRes, type, this); } //-------------------------------------------------------------------------------- TTimer::~TTimer() { - delete m_imp; } //-------------------------------------------------------------------------------- diff --git a/toonz/sources/common/tcache/timagecache.cpp b/toonz/sources/common/tcache/timagecache.cpp index 3bed35c..7b139ef 100644 --- a/toonz/sources/common/tcache/timagecache.cpp +++ b/toonz/sources/common/tcache/timagecache.cpp @@ -1127,7 +1127,6 @@ TImageCache::~TImageCache() { assert(check == magic); check = -1; - delete m_imp; CacheInstance = 0; } diff --git a/toonz/sources/common/tcore/tundo.cpp b/toonz/sources/common/tcore/tundo.cpp index ebfcc31..5cb4d38 100644 --- a/toonz/sources/common/tcore/tundo.cpp +++ b/toonz/sources/common/tcore/tundo.cpp @@ -174,7 +174,6 @@ TUndoManager *TUndoManager::manager() TUndoManager::TUndoManager() : m_imp(new TUndoManagerImp) { - // cout << "Creato undo manager" << endl; } //----------------------------------------------------------------------------- @@ -184,7 +183,6 @@ TUndoManager::~TUndoManager() //cout << "Distrutto undo manager" << endl; assert(m_imp->m_blockStack.empty()); reset(); - delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tfx/tfx.cpp b/toonz/sources/common/tfx/tfx.cpp index 02cfbea..293bb65 100644 --- a/toonz/sources/common/tfx/tfx.cpp +++ b/toonz/sources/common/tfx/tfx.cpp @@ -292,8 +292,7 @@ DEFINE_CLASS_CODE(TFx, 3) TFx::TFx() : TSmartObject(m_classCode) // TPersist(TFxImp::m_instances) - , - m_imp(new TFxImp(this)) + , m_imp(new TFxImp(this)) { } diff --git a/toonz/sources/common/tfx/tfxcachemanager.cpp b/toonz/sources/common/tfx/tfxcachemanager.cpp index 66ca963..786119d 100644 --- a/toonz/sources/common/tfx/tfxcachemanager.cpp +++ b/toonz/sources/common/tfx/tfxcachemanager.cpp @@ -162,8 +162,6 @@ TFxCacheManager::~TFxCacheManager() std::set::iterator it; for (it = m_staticCacheIds.begin(); it != m_staticCacheIds.end(); ++it) TImageCache::instance()->remove(*it); - - delete m_imp; } //----------------------------------------------------------------------------------- diff --git a/toonz/sources/common/tfx/tpredictivecachemanager.cpp b/toonz/sources/common/tfx/tpredictivecachemanager.cpp index e432dec..43b19d8 100644 --- a/toonz/sources/common/tfx/tpredictivecachemanager.cpp +++ b/toonz/sources/common/tfx/tpredictivecachemanager.cpp @@ -68,17 +68,28 @@ public: QMutex m_mutex; public: - //Active getResource(..) callback - typedef void (TPredictiveCacheManager::Imp::*GetResourceFuncPtr)(TCacheResourceP &resource, const string &alias, - const TFxP &fx, double frame, const TRenderSettings &rs, - ResourceDeclaration *resData); - - GetResourceFuncPtr m_getResFuncPtr; - -public: Imp() - : m_renderStatus(TRenderer::IDLE), m_getResFuncPtr(&Imp::getResourceComputing), m_enabled(TRenderer::instance().isPrecomputingEnabled()) {} + : m_renderStatus(TRenderer::IDLE) + , m_enabled(TRenderer::instance().isPrecomputingEnabled()) + { + } + void run(TCacheResourceP &resource, const string &alias, + const TFxP &fx, double frame, const TRenderSettings &rs, + ResourceDeclaration *resData) + { + switch (m_renderStatus) { + case TRenderer::IDLE: + case TRenderer::COMPUTING: + getResourceComputing(resource, alias, fx, frame, rs, resData); + break; + case TRenderer::TESTRUN: + getResourceTestRun(resource, alias, fx, frame, rs, resData); + break; + } + } + +private: void getResourceTestRun( TCacheResourceP &resource, const string &alias, const TFxP &fx, double frame, const TRenderSettings &rs, @@ -103,7 +114,6 @@ TPredictiveCacheManager::TPredictiveCacheManager() TPredictiveCacheManager::~TPredictiveCacheManager() { - delete m_imp; } //--------------------------------------------------------------------------- @@ -128,7 +138,7 @@ void TPredictiveCacheManager::getResource( if (!m_imp->m_enabled) return; - (m_imp->*(m_imp->m_getResFuncPtr))(resource, alias, fx, frame, rs, resData); + m_imp->run(resource, alias, fx, frame, rs, resData); } //************************************************************************************************ @@ -207,11 +217,6 @@ void TPredictiveCacheManager::Imp::getResourceComputing( void TPredictiveCacheManager::onRenderStatusStart(int renderStatus) { m_imp->m_renderStatus = renderStatus; - switch (renderStatus) { - case TRenderer::TESTRUN: - m_imp->m_getResFuncPtr = &TPredictiveCacheManager::Imp::getResourceTestRun; - CASE TRenderer::COMPUTING : m_imp->m_getResFuncPtr = &TPredictiveCacheManager::Imp::getResourceComputing; - } } //--------------------------------------------------------------------------- diff --git a/toonz/sources/common/tgl/tstencilcontrol.cpp b/toonz/sources/common/tgl/tstencilcontrol.cpp index 57aaaeb..fae7e40 100644 --- a/toonz/sources/common/tgl/tstencilcontrol.cpp +++ b/toonz/sources/common/tgl/tstencilcontrol.cpp @@ -130,7 +130,6 @@ TStencilControl::TStencilControl() TStencilControl::~TStencilControl() { - delete m_imp; } //--------------------------------------------------------- diff --git a/toonz/sources/common/tmeshimage/tmeshimage.cpp b/toonz/sources/common/tmeshimage/tmeshimage.cpp index da809c9..62b368d 100644 --- a/toonz/sources/common/tmeshimage/tmeshimage.cpp +++ b/toonz/sources/common/tmeshimage/tmeshimage.cpp @@ -330,8 +330,8 @@ TMeshImage::TMeshImage() //----------------------------------------------------------------------- -TMeshImage::TMeshImage(Imp *imp) - : m_imp(imp) +TMeshImage::TMeshImage(std::shared_ptr imp) + : m_imp(std::move(imp)) { } @@ -339,7 +339,6 @@ TMeshImage::TMeshImage(Imp *imp) TMeshImage::~TMeshImage() { - delete m_imp; } //----------------------------------------------------------------------- diff --git a/toonz/sources/common/tparam/tdoubleparam.cpp b/toonz/sources/common/tparam/tdoubleparam.cpp index ca3770c..e26ecd1 100644 --- a/toonz/sources/common/tparam/tdoubleparam.cpp +++ b/toonz/sources/common/tparam/tdoubleparam.cpp @@ -351,7 +351,7 @@ public: ~Imp() {} - void copy(Imp *src) + void copy(std::unique_ptr const& src) { m_grammar = src->m_grammar; m_measureName = src->m_measureName; @@ -503,7 +503,6 @@ TDoubleParam::TDoubleParam(const TDoubleParam &src) TDoubleParam::~TDoubleParam() { - delete m_imp; } //--------------------------------------------------------- diff --git a/toonz/sources/common/tparam/tnotanimatableparam.cpp b/toonz/sources/common/tparam/tnotanimatableparam.cpp index 414a302..86fa65d 100644 --- a/toonz/sources/common/tparam/tnotanimatableparam.cpp +++ b/toonz/sources/common/tparam/tnotanimatableparam.cpp @@ -133,7 +133,7 @@ class TEnumParamImp { public: vector> m_items; - void copy(TEnumParamImp *src) + void copy(std::unique_ptr& src) { m_items.clear(); std::back_insert_iterator>> bii(m_items); @@ -171,7 +171,6 @@ void TEnumParam::copy(TParam *src) TEnumParam::~TEnumParam() { - delete m_imp; } //--------------------------------------------------------- diff --git a/toonz/sources/common/tparam/tparamcontainer.cpp b/toonz/sources/common/tparam/tparamcontainer.cpp index f489dbc..d58fa4c 100644 --- a/toonz/sources/common/tparam/tparamcontainer.cpp +++ b/toonz/sources/common/tparam/tparamcontainer.cpp @@ -37,7 +37,6 @@ TParamContainer::TParamContainer() TParamContainer::~TParamContainer() { - delete m_imp; } void TParamContainer::setParamObserver(TParamObserver *observer) diff --git a/toonz/sources/common/tparam/tparamset.cpp b/toonz/sources/common/tparam/tparamset.cpp index 49376de..7d6ef90 100644 --- a/toonz/sources/common/tparam/tparamset.cpp +++ b/toonz/sources/common/tparam/tparamset.cpp @@ -103,23 +103,22 @@ public: TParamSet::TParamSet(string name) : TParam(name) + , m_imp(new TParamSetImp(this)) { - m_imp = new TParamSetImp(this); } //--------------------------------------------------------- TParamSet::TParamSet(const TParamSet &src) : TParam(src.getName()) + , m_imp(new TParamSetImp(this)) { - m_imp = new TParamSetImp(this); } //--------------------------------------------------------- TParamSet::~TParamSet() { - delete m_imp; } //--------------------------------------------------------- diff --git a/toonz/sources/common/tparam/tspectrumparam.cpp b/toonz/sources/common/tparam/tspectrumparam.cpp index a55a88b..ee65526 100644 --- a/toonz/sources/common/tparam/tspectrumparam.cpp +++ b/toonz/sources/common/tparam/tspectrumparam.cpp @@ -113,9 +113,8 @@ PERSIST_IDENTIFIER(TSpectrumParam, "spectrumParam") //--------------------------------------------------------- -TSpectrumParam::TSpectrumParam() +TSpectrumParam::TSpectrumParam(): m_imp(new TSpectrumParamImp(this)) //brutto... { - m_imp = new TSpectrumParamImp(this); //brutto... ColorKeyParam ck1(TDoubleParamP(0.0), TPixelParamP(TPixel32::Black)); ColorKeyParam ck2(TDoubleParamP(1.0), TPixelParamP(TPixel32::White)); m_imp->addKey(ck1); @@ -126,8 +125,8 @@ TSpectrumParam::TSpectrumParam() TSpectrumParam::TSpectrumParam(const TSpectrumParam &src) : TParam(src.getName()) + , m_imp(new TSpectrumParamImp(*src.m_imp)) { - m_imp = new TSpectrumParamImp(*src.m_imp); } //--------------------------------------------------------- @@ -147,8 +146,8 @@ void TSpectrumParam::removeObserver(TParamObserver *obs) //--------------------------------------------------------- TSpectrumParam::TSpectrumParam(int keyCount, TSpectrum::ColorKey keys[]) + : m_imp(new TSpectrumParamImp(this)) { - m_imp = new TSpectrumParamImp(this); for (int i = 0; i < keyCount; i++) { double v = keys[i].first; TPixel32 pix = keys[i].second; @@ -175,7 +174,6 @@ void TSpectrumParam::copy(TParam *src) TSpectrumParam::~TSpectrumParam() { - delete m_imp; } //--------------------------------------------------------- diff --git a/toonz/sources/common/trop/tdistancetransform.cpp b/toonz/sources/common/trop/tdistancetransform.cpp index 0e16f62..f6175e5 100644 --- a/toonz/sources/common/trop/tdistancetransform.cpp +++ b/toonz/sources/common/trop/tdistancetransform.cpp @@ -1,13 +1,10 @@ - +#include #include "tropcm.h" // TnzCore includes #include "traster.h" -// boost includes -#include - // STD includes #include @@ -113,7 +110,7 @@ void expand(int lineLength, int linesCount, // Allocate a buffer equivalent to a dt line. It will store the original // dt values. Final dt values will be written directly on the dt raster. // This is necessary since read and write intervals overlap. - boost::scoped_array dtOriginalLine(new unsigned int[lineLength]); + std::unique_ptr dtOriginalLine(new unsigned[lineLength]); unsigned int *odtLineStart = dtOriginalLine.get(), *odtLineEnd = odtLineStart + lineLength; diff --git a/toonz/sources/common/trop/trop_borders.cpp b/toonz/sources/common/trop/trop_borders.cpp index 4332afd..11baa40 100644 --- a/toonz/sources/common/trop/trop_borders.cpp +++ b/toonz/sources/common/trop/trop_borders.cpp @@ -201,7 +201,6 @@ ImageMeshesReader::ImageMeshesReader() ImageMeshesReader::~ImageMeshesReader() { - delete m_imp; } //-------------------------------------------------------------------------------- diff --git a/toonz/sources/common/tsound/tsound_mac.cpp b/toonz/sources/common/tsound/tsound_mac.cpp index a225dda..63dd759 100644 --- a/toonz/sources/common/tsound/tsound_mac.cpp +++ b/toonz/sources/common/tsound/tsound_mac.cpp @@ -22,7 +22,7 @@ namespace TThread::Mutex MutexOut; } -class TSoundOutputDeviceImp +class TSoundOutputDeviceImp : public std::enable_shared_from_this { public: bool m_isPlaying; @@ -65,10 +65,18 @@ struct MyData { void *sourceBuffer; AudioConverterRef converter; - TSoundOutputDeviceImp *imp; + std::shared_ptr imp; bool isLooping; MyData() - : entireFileBuffer(0), totalPacketCount(0), fileByteCount(0), maxPacketSize(0), packetOffset(0), byteOffset(0), sourceBuffer(0), isLooping(false), imp(0), m_doNotify(true) + : entireFileBuffer(0) + , totalPacketCount(0) + , fileByteCount(0) + , maxPacketSize(0) + , packetOffset(0) + , byteOffset(0) + , sourceBuffer(0) + , isLooping(false) + , m_doNotify(true) { } }; @@ -341,7 +349,6 @@ TSoundOutputDevice::~TSoundOutputDevice() { stop(); close(); - delete m_imp; } //------------------------------------------------------------------------------ @@ -415,7 +422,7 @@ void TSoundOutputDeviceImp::play(const TSoundTrackP &st, TINT32 s0, TINT32 s1, b OSStatus err = noErr; MyData *myData = new MyData(); - myData->imp = this; + myData->imp = shared_from_this(); UInt32 magicCookieSize = 0; //PrintStreamDesc(&outputASBD); err = AudioConverterNew(&fileASBD, &outputASBD, &converter); @@ -710,11 +717,6 @@ TSoundInputDevice::TSoundInputDevice() : m_imp(new TSoundInputDeviceImp) TSoundInputDevice::~TSoundInputDevice() { - /* - if(m_imp->m_port) - alClosePort(m_imp->m_port); - delete m_imp; - */ } //------------------------------------------------------------------------------ diff --git a/toonz/sources/common/tsound/tsound_nt.cpp b/toonz/sources/common/tsound/tsound_nt.cpp index d1c8e94..80a4908 100644 --- a/toonz/sources/common/tsound/tsound_nt.cpp +++ b/toonz/sources/common/tsound/tsound_nt.cpp @@ -647,7 +647,6 @@ TSoundOutputDevice::~TSoundOutputDevice() close(); WaitForSingleObject(m_imp->m_closeDevice, INFINITE); CloseHandle(m_imp->m_closeDevice); - delete m_imp; } //------------------------------------------------------------------------------ @@ -1111,14 +1110,14 @@ void WinSoundInputDevice::stop() class RecordTask : public TThread::Runnable { public: - RecordTask(TSoundInputDeviceImp *dev) - : Runnable(), m_dev(dev) {} + RecordTask(std::shared_ptr dev) + : Runnable(), m_dev(std::move(dev)) {} ~RecordTask() {} void run(); - TSoundInputDeviceImp *m_dev; + std::shared_ptr m_dev; }; #endif @@ -1268,7 +1267,6 @@ TSoundInputDevice::TSoundInputDevice() : m_imp(new TSoundInputDeviceImp()) TSoundInputDevice::~TSoundInputDevice() { - delete m_imp; } //------------------------------------------------------------------------------ diff --git a/toonz/sources/common/tstream/tstream.cpp b/toonz/sources/common/tstream/tstream.cpp index 8e48833..bd4fb82 100644 --- a/toonz/sources/common/tstream/tstream.cpp +++ b/toonz/sources/common/tstream/tstream.cpp @@ -256,8 +256,8 @@ TOStream::TOStream(const TFilePath &fp, bool compressed) //--------------------------------------------------------------- -TOStream::TOStream(Imp *imp) - : m_imp(imp) +TOStream::TOStream(std::shared_ptr imp) + : m_imp(std::move(imp)) { assert(!imp->m_tagStack.empty()); ostream &os = *m_imp->m_os; @@ -314,7 +314,6 @@ TOStream::~TOStream() } if (m_imp->m_chanOwner) delete m_imp->m_os; - delete m_imp; } } catch (...) { } @@ -497,12 +496,11 @@ TOStream::operator bool() const } //--------------------------------------------------------------- - TOStream TOStream::child(string tagName) { assert(tagName != ""); m_imp->m_tagStack.push_back(tagName); - return TOStream(m_imp); + return m_imp; } //--------------------------------------------------------------- @@ -981,7 +979,6 @@ TIStream::~TIStream() { if (m_imp->m_chanOwner) delete m_imp->m_is; - delete m_imp; } //--------------------------------------------------------------- diff --git a/toonz/sources/common/tsystem/tlogger.cpp b/toonz/sources/common/tsystem/tlogger.cpp index 495adf1..c21b1da 100644 --- a/toonz/sources/common/tsystem/tlogger.cpp +++ b/toonz/sources/common/tsystem/tlogger.cpp @@ -12,49 +12,6 @@ using std::endl; -/* -class TLogger::Imp { -public: - std::ofstream m_os; - TThread::Mutex m_mutex; - - Imp(const TFilePath &fp) - : m_os(toString(fp.getWideString()).c_str(), std::ios_base::out | std::ios_base::app) - , m_mutex() - { - TTime t = TSystem::getCurrentTime(); - m_os << "========================" << std::endl; - m_os << t.getDate() << " " << t.getTime() << endl; - m_os << "Start logging" << endl << endl; - } -}; - - -TLogger::TLogger() -: m_imp(new Imp(TSystem::getTempDir() + "log.txt")) -{ -} - - -TLogger::~TLogger() -{ - delete m_imp; -} - -TLogger *TLogger::instance() -{ - static TLogger _instance; - return &_instance; -} - - -void TLogger::print(string module, string msg) -{ - QMutexLocker sl(m_imp->m_mutex); - m_imp->m_os << module << " : " << msg << std::endl; -} -*/ - class TLogger::Imp { public: @@ -96,7 +53,6 @@ TLogger::TLogger() TLogger::~TLogger() { - delete m_imp; } TLogger *TLogger::instance() diff --git a/toonz/sources/common/tvectorimage/tl2lautocloser.cpp b/toonz/sources/common/tvectorimage/tl2lautocloser.cpp index c058e85..f91ee2b 100644 --- a/toonz/sources/common/tvectorimage/tl2lautocloser.cpp +++ b/toonz/sources/common/tvectorimage/tl2lautocloser.cpp @@ -529,8 +529,6 @@ TL2LAutocloser::TL2LAutocloser() TL2LAutocloser::~TL2LAutocloser() { - delete m_imp; - m_imp = 0; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tvectorimage/tl2lautocloser.h b/toonz/sources/common/tvectorimage/tl2lautocloser.h index ec319a3..2a4cbbd 100644 --- a/toonz/sources/common/tvectorimage/tl2lautocloser.h +++ b/toonz/sources/common/tvectorimage/tl2lautocloser.h @@ -1,8 +1,8 @@ - - #ifndef T_L2LAUTOCLOSER_H #define T_L2LAUTOCLOSER_H +#include + #include "tgeometry.h" #undef DVAPI @@ -28,7 +28,7 @@ class TStroke; class DVAPI TL2LAutocloser { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TL2LAutocloser(); diff --git a/toonz/sources/common/tvectorimage/tregion.cpp b/toonz/sources/common/tvectorimage/tregion.cpp index e1f3946..0b27899 100644 --- a/toonz/sources/common/tvectorimage/tregion.cpp +++ b/toonz/sources/common/tvectorimage/tregion.cpp @@ -144,7 +144,6 @@ TRegion::TRegion() TRegion::~TRegion() { - delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp index 999749d..9e306f9 100644 --- a/toonz/sources/common/tvectorimage/tstroke.cpp +++ b/toonz/sources/common/tvectorimage/tstroke.cpp @@ -1276,7 +1276,7 @@ TStroke::TStroke() p[1] = p[0]; p[2] = p[1]; - m_imp = new TStroke::Imp(p); + m_imp.reset(new TStroke::Imp(p)); /* // da fissare deve trovarsi prima della init @@ -1289,32 +1289,30 @@ TStroke::TStroke() // Build a stroke from a set of ThickPoint TStroke::TStroke(const vector &v) : TSmartObject(m_classCode) + , m_imp(new TStroke::Imp(v)) { - m_imp = new TStroke::Imp(v); } //----------------------------------------------------------------------------- TStroke::TStroke(const vector &v) : TSmartObject(m_classCode) + , m_imp(new TStroke::Imp(v)) { - m_imp = new TStroke::Imp(v); } //----------------------------------------------------------------------------- TStroke::~TStroke() { - delete m_imp; } //----------------------------------------------------------------------------- TStroke::TStroke(const TStroke &other) : TSmartObject(m_classCode) + , m_imp(new TStroke::Imp()) { - m_imp = new TStroke::Imp(); - m_imp->m_bBox = other.getBBox(); m_imp->m_isValidLength = other.m_imp->m_isValidLength; m_imp->m_isOutlineValid = other.m_imp->m_isOutlineValid; diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp index f6c3572..248f4d0 100644 --- a/toonz/sources/common/tvectorimage/tvectorimage.cpp +++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp @@ -104,8 +104,8 @@ TVectorImage::Imp::~Imp() //============================================================================= TVectorImage::TVectorImage(bool loaded) + : m_imp(new TVectorImage::Imp(this)) { - m_imp = new TVectorImage::Imp(this); if (loaded) m_imp->m_justLoaded = true; } @@ -114,7 +114,6 @@ TVectorImage::TVectorImage(bool loaded) TVectorImage::~TVectorImage() { - delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tvrender/qtofflinegl.cpp b/toonz/sources/common/tvrender/qtofflinegl.cpp index 0793b00..4c8eca5 100644 --- a/toonz/sources/common/tvrender/qtofflinegl.cpp +++ b/toonz/sources/common/tvrender/qtofflinegl.cpp @@ -78,10 +78,12 @@ void rightRotateBits(UCHAR *buf, int bufferSize) //----------------------------------------------------------------------------- -QtOfflineGL::QtOfflineGL(TDimension rasterSize, const TOfflineGL::Imp *shared) - : TOfflineGL::Imp(rasterSize.lx, rasterSize.ly), m_context(0), m_oldContext(0) +QtOfflineGL::QtOfflineGL(TDimension rasterSize, std::shared_ptr shared) + : TOfflineGL::Imp(rasterSize.lx, rasterSize.ly) + , m_context(0) + , m_oldContext(0) { - createContext(rasterSize, shared); + createContext(rasterSize, std::move(shared)); /* makeCurrent(); @@ -101,7 +103,7 @@ QtOfflineGL::~QtOfflineGL() //----------------------------------------------------------------------------- -void QtOfflineGL::createContext(TDimension rasterSize, const TOfflineGL::Imp *shared) +void QtOfflineGL::createContext(TDimension rasterSize, std::shared_ptr shared) { // Imposto il formato dei Pixel (pixelFormat) /* diff --git a/toonz/sources/common/tvrender/tinbetween.cpp b/toonz/sources/common/tvrender/tinbetween.cpp index 82e6ec0..f9d2c39 100644 --- a/toonz/sources/common/tvrender/tinbetween.cpp +++ b/toonz/sources/common/tvrender/tinbetween.cpp @@ -709,7 +709,6 @@ TInbetween::TInbetween(const TVectorImageP firstImage, const TVectorImageP lastI TInbetween::~TInbetween() { - delete m_imp; } //------------------------------------------------------------------- diff --git a/toonz/sources/common/tvrender/tofflinegl.cpp b/toonz/sources/common/tvrender/tofflinegl.cpp index 5ea9202..bccfb70 100644 --- a/toonz/sources/common/tvrender/tofflinegl.cpp +++ b/toonz/sources/common/tvrender/tofflinegl.cpp @@ -83,11 +83,11 @@ public: //----------------------------------------------------------------------------- - WIN32Implementation(TDimension rasterSize, const TOfflineGL::Imp *shared = 0) + WIN32Implementation(TDimension rasterSize, std::shared_ptr shared) : TOfflineGL::Imp(rasterSize.lx, rasterSize.ly) { m_offData = 0; - createContext(rasterSize, shared); //makeCurrent is called at the end of this + createContext(rasterSize, std::move(shared)); //makeCurrent is called at the end of this glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); @@ -157,7 +157,7 @@ public: //----------------------------------------------------------------------------- - void createContext(TDimension rasterSize, const TOfflineGL::Imp *shared) + void createContext(TDimension rasterSize, std::shared_ptr shared) { QMutexLocker locker(&win32ImpMutex); @@ -221,7 +221,7 @@ public: if (shared) { // Share shared's display lists - const WIN32Implementation *sharedImp = dynamic_cast(shared); + const WIN32Implementation *sharedImp = dynamic_cast(shared.get()); assert(sharedImp); bool ok = wglShareLists(sharedImp->m_hglRC, m_hglRC); @@ -298,9 +298,9 @@ public: }; // default imp generator -TOfflineGL::Imp *defaultOfflineGLGenerator(const TDimension &dim, const TOfflineGL::Imp *shared) +std::shared_ptr defaultOfflineGLGenerator(const TDimension &dim, std::shared_ptr shared) { - return new WIN32Implementation(dim, shared); + return std::make_shared(dim, shared); } //============================================================================= @@ -502,16 +502,16 @@ public: } }; -TOfflineGL::Imp *defaultOfflineGLGenerator(const TDimension &dim) +std::shared_ptr defaultOfflineGLGenerator(const TDimension &dim, std::shared_ptr shared) { - return new XImplementation(dim); + return std::make_shared(dim); } #elif MACOSX -TOfflineGL::Imp *defaultOfflineGLGenerator(const TDimension &dim, const TOfflineGL::Imp *shared) +std::shared_ptr defaultOfflineGLGenerator(const TDimension &dim, std::shared_ptr shared) { - return new QtOfflineGL(dim, shared); + return std::make_shared(dim, shared); } #endif @@ -538,11 +538,11 @@ class MessageCreateContext : public TThread::Message TOfflineGL *m_ogl; TDimension m_size; - const TOfflineGL::Imp *m_shared; + std::shared_ptr m_shared; public: - MessageCreateContext(TOfflineGL *ogl, const TDimension &size, const TOfflineGL::Imp *shared) - : m_ogl(ogl), m_size(size), m_shared(shared) {} + MessageCreateContext(TOfflineGL *ogl, const TDimension &size, std::shared_ptr shared) + : m_ogl(ogl), m_size(size), m_shared(std::move(shared)) {} void onDeliver() { @@ -560,19 +560,18 @@ public: //-------------------------------------------------- TOfflineGL::TOfflineGL(TDimension dim, const TOfflineGL *shared) - : m_imp(0) { #if defined(LINUX) XScopedLock xsl; #endif - const TOfflineGL::Imp *sharedImp = shared ? shared->m_imp : 0; + std::shared_ptr sharedImp = shared ? shared->m_imp : 0; /* 元のコードは(別スレッドから呼び出すための) offline renderer を作って main thread に dispatch するという訳のわからないことをしていたが Q*GLContext は thread context を超えられないので直接生成してこのコンテキストで閉じる. 別スレッドには dispatch しない. */ - m_imp = currentImpGenerator(dim, sharedImp); + m_imp = currentImpGenerator(dim, std::move(sharedImp)); initMatrix(); } @@ -585,8 +584,6 @@ TOfflineGL::TOfflineGL(const TRaster32P &raster, const TOfflineGL *shared) XScopedLock xsl; #endif - //m_imp = new Imp(raster->getSize()); - m_imp = currentImpGenerator(raster->getSize(), shared->m_imp); initMatrix(); @@ -601,7 +598,6 @@ TOfflineGL::TOfflineGL(const TRaster32P &raster, const TOfflineGL *shared) TOfflineGL::~TOfflineGL() { - delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/common/tvrender/tstrokedeformations.cpp b/toonz/sources/common/tvrender/tstrokedeformations.cpp index f5c1591..0a36b5a 100644 --- a/toonz/sources/common/tvrender/tstrokedeformations.cpp +++ b/toonz/sources/common/tvrender/tstrokedeformations.cpp @@ -189,8 +189,8 @@ struct TStrokePointDeformation::Imp { TStrokePointDeformation::TStrokePointDeformation(const TPointD ¢er, double radius) + : m_imp(new Imp(center, radius)) { - m_imp = new Imp(center, radius); } //----------------------------------------------------------------------------- @@ -198,15 +198,14 @@ TStrokePointDeformation::TStrokePointDeformation(const TPointD ¢er, TStrokePointDeformation::TStrokePointDeformation(const TPointD &vect, const TPointD ¢er, double radius) + : m_imp(new Imp(vect, center, radius)) { - m_imp = new Imp(vect, center, radius); } //----------------------------------------------------------------------------- TStrokePointDeformation::~TStrokePointDeformation() { - delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/include/ext/meshtexturizer.h b/toonz/sources/include/ext/meshtexturizer.h index 5ade95e..99724e2 100644 --- a/toonz/sources/include/ext/meshtexturizer.h +++ b/toonz/sources/include/ext/meshtexturizer.h @@ -1,8 +1,8 @@ - - #ifndef MESHTEXTURIZER_H #define MESHTEXTURIZER_H +#include + // TnzCore includes #include "traster.h" #include "tgl.h" // OpenGL includes @@ -95,7 +95,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; private: // Not copyable diff --git a/toonz/sources/include/ext/plasticdeformer.h b/toonz/sources/include/ext/plasticdeformer.h index 89ed713..726571d 100644 --- a/toonz/sources/include/ext/plasticdeformer.h +++ b/toonz/sources/include/ext/plasticdeformer.h @@ -1,8 +1,8 @@ - - #ifndef PLASTICDEFORMER_H #define PLASTICDEFORMER_H +#include + // TnzCore includes #include "tgeometry.h" #include "tmeshimage.h" @@ -42,7 +42,7 @@ class DVAPI PlasticDeformer { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: PlasticDeformer(); diff --git a/toonz/sources/include/ext/plasticdeformerstorage.h b/toonz/sources/include/ext/plasticdeformerstorage.h index f5840df..36cab1b 100644 --- a/toonz/sources/include/ext/plasticdeformerstorage.h +++ b/toonz/sources/include/ext/plasticdeformerstorage.h @@ -1,8 +1,8 @@ - - #ifndef PLASTIDEFORMERSTORAGE_H #define PLASTIDEFORMERSTORAGE_H +#include + // TnzExt includes #include "ext/plasticdeformer.h" @@ -158,7 +158,7 @@ private: class DVAPI PlasticDeformerStorage { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: enum DataType { diff --git a/toonz/sources/include/ext/plasticskeleton.h b/toonz/sources/include/ext/plasticskeleton.h index fc3e64f..774ce79 100644 --- a/toonz/sources/include/ext/plasticskeleton.h +++ b/toonz/sources/include/ext/plasticskeleton.h @@ -1,8 +1,8 @@ - - #ifndef PLASTICSKELETON_H #define PLASTICSKELETON_H +#include + // TnzCore includes #include "tsmartpointer.h" #include "tpersist.h" @@ -102,7 +102,7 @@ class DVAPI PlasticSkeleton : public TSmartObject, public tcg::Mesh m_imp; public: typedef tcg::Mesh> mesh_type; @@ -139,14 +139,10 @@ public: std::vector verticesToHandles() const; public: -// RValues-related functions -#ifndef BOOST_NO_RVALUE_REFERENCES - + // RValues-related functions PlasticSkeleton(PlasticSkeleton &&other); PlasticSkeleton &operator=(PlasticSkeleton &&other); -#endif - private: friend class PlasticSkeletonDeformation; // Skeleton deformations can register to be notified diff --git a/toonz/sources/include/ext/plasticskeletondeformation.h b/toonz/sources/include/ext/plasticskeletondeformation.h index 1301f94..17dad65 100644 --- a/toonz/sources/include/ext/plasticskeletondeformation.h +++ b/toonz/sources/include/ext/plasticskeletondeformation.h @@ -1,8 +1,8 @@ - - #ifndef PLASTICSKELETONDEFORMATION_H #define PLASTICSKELETONDEFORMATION_H +#include + // TnzCore includes #include "tsmartpointer.h" #include "tdoubleparam.h" @@ -139,7 +139,7 @@ class DVAPI PlasticSkeletonDeformation : public TSmartObject, public TPersist private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: typedef tcg::any_it::bidirectional skelId_iterator; diff --git a/toonz/sources/include/ext/ttexturesstorage.h b/toonz/sources/include/ext/ttexturesstorage.h index 94beb45..b97a373 100644 --- a/toonz/sources/include/ext/ttexturesstorage.h +++ b/toonz/sources/include/ext/ttexturesstorage.h @@ -1,17 +1,14 @@ - - #ifndef DRAWABLEMESHIMAGE_H #define DRAWABLEMESHIMAGE_H +#include + // TnzExt includes #include "meshtexturizer.h" // TnzCore includes #include "tgldisplaylistsmanager.h" -// Boost includes -#include - #undef DVAPI #undef DVVAR #ifdef TNZEXT_EXPORTS @@ -48,7 +45,7 @@ private: DrawableTextureData &operator=(const DrawableTextureData &); }; -typedef boost::shared_ptr DrawableTextureDataP; +typedef std::shared_ptr DrawableTextureDataP; //*************************************************************************************** // TexturesStorage declaration diff --git a/toonz/sources/include/permissionsmanager.h b/toonz/sources/include/permissionsmanager.h index a317146..b8c1c11 100644 --- a/toonz/sources/include/permissionsmanager.h +++ b/toonz/sources/include/permissionsmanager.h @@ -1,8 +1,8 @@ - - #ifndef PERMISSIONSMANAGER_INCLUDED #define PERMISSIONSMANAGER_INCLUDED +#include + // TnzCore includes #include "tcommon.h" @@ -31,7 +31,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; private: PermissionsManager(); diff --git a/toonz/sources/include/qtofflinegl.h b/toonz/sources/include/qtofflinegl.h index 5fd8316..f0e6022 100644 --- a/toonz/sources/include/qtofflinegl.h +++ b/toonz/sources/include/qtofflinegl.h @@ -1,8 +1,8 @@ - - #ifndef QTOFFLINEGL_H #define QTOFFLINEGL_H +#include + #include #include #include @@ -17,10 +17,10 @@ public: QOpenGLContext *m_oldContext; QOffscreenSurface *m_surface; - QtOfflineGL(TDimension rasterSize, const TOfflineGL::Imp *shared = 0); + QtOfflineGL(TDimension rasterSize, std::shared_ptr shared); ~QtOfflineGL(); - void createContext(TDimension rasterSize, const TOfflineGL::Imp *shared); + void createContext(TDimension rasterSize, std::shared_ptr shared); void makeCurrent(); void doneCurrent(); diff --git a/toonz/sources/include/stdfx/shadingcontext.h b/toonz/sources/include/stdfx/shadingcontext.h index de1eaea..6619395 100644 --- a/toonz/sources/include/stdfx/shadingcontext.h +++ b/toonz/sources/include/stdfx/shadingcontext.h @@ -1,8 +1,8 @@ - - #ifndef SHADINGCONTEXT_H #define SHADINGCONTEXT_H +#include + // Glew include #include @@ -89,7 +89,7 @@ public: private: struct Imp; - Imp *m_imp; + std::unique_ptr m_imp; // Not copyable ShadingContext(const ShadingContext &); diff --git a/toonz/sources/include/tcli.h b/toonz/sources/include/tcli.h index 7b3dff8..5aa2f59 100644 --- a/toonz/sources/include/tcli.h +++ b/toonz/sources/include/tcli.h @@ -1,8 +1,8 @@ - - #ifndef TCLI_INCLUDED #define TCLI_INCLUDED +#include + //#include "tcommon.h" contenuto in tconvert.h #include "tconvert.h" @@ -342,7 +342,7 @@ class UsageImp; class DVAPI Usage { - UsageImp *m_imp; + std::unique_ptr m_imp; public: Usage(string progName); diff --git a/toonz/sources/include/tdoubleparam.h b/toonz/sources/include/tdoubleparam.h index 384d14f..3cc51f6 100644 --- a/toonz/sources/include/tdoubleparam.h +++ b/toonz/sources/include/tdoubleparam.h @@ -1,8 +1,8 @@ - - #ifndef TDOUBLEPARAM_H #define TDOUBLEPARAM_H +#include + // TnzCore includes #include "tgeometry.h" #include "tfilepath.h" @@ -55,7 +55,7 @@ class DVAPI TDoubleParam : public TParam PERSIST_DECLARATION(TDoubleParam) class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TDoubleParam(double v = 0.0); diff --git a/toonz/sources/include/texpression.h b/toonz/sources/include/texpression.h index 996b8ea..c29fb36 100644 --- a/toonz/sources/include/texpression.h +++ b/toonz/sources/include/texpression.h @@ -1,8 +1,8 @@ - - #ifndef TEXPRESSION_INCLUDED #define TEXPRESSION_INCLUDED +#include + // TnzCore includes #include "tcommon.h" @@ -47,7 +47,7 @@ class Calculator; class DVAPI TExpression { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TExpression(); diff --git a/toonz/sources/include/tfarmserver.h b/toonz/sources/include/tfarmserver.h index ef1e6ee..3470f04 100644 --- a/toonz/sources/include/tfarmserver.h +++ b/toonz/sources/include/tfarmserver.h @@ -1,10 +1,8 @@ - - #ifndef TFARMSERVER_H #define TFARMSERVER_H -//#include "texception.h" -//#include "tconvert.h" +#include + #include "tcommon.h" #include @@ -87,7 +85,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; }; #endif diff --git a/toonz/sources/include/tfarmtask.h b/toonz/sources/include/tfarmtask.h index 8518848..aa05298 100644 --- a/toonz/sources/include/tfarmtask.h +++ b/toonz/sources/include/tfarmtask.h @@ -1,8 +1,8 @@ - - #ifndef TFARMTASK_H #define TFARMTASK_H +#include + #include #include "tpersist.h" #include "tfarmplatforms.h" @@ -196,7 +196,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; }; #endif diff --git a/toonz/sources/include/tfx.h b/toonz/sources/include/tfx.h index 2f77a36..4be1eaa 100644 --- a/toonz/sources/include/tfx.h +++ b/toonz/sources/include/tfx.h @@ -1,8 +1,8 @@ - - #ifndef TFX_INCLUDED #define TFX_INCLUDED +#include + // TnzCore includes #include "tsmartpointer.h" #include "tpersist.h" diff --git a/toonz/sources/include/tfxcachemanager.h b/toonz/sources/include/tfxcachemanager.h index d8ee3ab..e2ae865 100644 --- a/toonz/sources/include/tfxcachemanager.h +++ b/toonz/sources/include/tfxcachemanager.h @@ -1,8 +1,8 @@ - - #ifndef TFXCACHEMANAGER_H #define TFXCACHEMANAGER_H +#include + #include "trenderresourcemanager.h" #include "tcacheresource.h" @@ -182,7 +182,7 @@ private: std::set m_staticCacheIds; class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TFxCacheManager(); diff --git a/toonz/sources/include/tgrammar.h b/toonz/sources/include/tgrammar.h index c0909b6..bf91dff 100644 --- a/toonz/sources/include/tgrammar.h +++ b/toonz/sources/include/tgrammar.h @@ -1,8 +1,8 @@ - - #ifndef TGRAMMAR_INCLUDED #define TGRAMMAR_INCLUDED +#include + // TnzCore includes #include "tcommon.h" @@ -198,7 +198,7 @@ public: class DVAPI Grammar { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: Grammar(); diff --git a/toonz/sources/include/timagecache.h b/toonz/sources/include/timagecache.h index 98c15d2..ec44926 100644 --- a/toonz/sources/include/timagecache.h +++ b/toonz/sources/include/timagecache.h @@ -1,8 +1,8 @@ - - #ifndef TIMAGECACHE_H #define TIMAGECACHE_H +#include + // TnzCore includes #include "tcommon.h" #include "timage.h" @@ -55,7 +55,7 @@ of system memory. This is especially true on 32-bit OSes. class DVAPI TImageCache { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: static TImageCache *instance(); diff --git a/toonz/sources/include/tinbetween.h b/toonz/sources/include/tinbetween.h index 467086f..28bebc9 100644 --- a/toonz/sources/include/tinbetween.h +++ b/toonz/sources/include/tinbetween.h @@ -1,9 +1,7 @@ - - #ifndef TINBETWEEN_H #define TINBETWEEN_H -//#include "tvectorimage.h" +#include #include "tcommon.h" class TVectorImageP; @@ -21,9 +19,8 @@ class TVectorImageP; class DVAPI TInbetween { - class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TInbetween(const TVectorImageP firstImage, const TVectorImageP lastImage); diff --git a/toonz/sources/include/tlogger.h b/toonz/sources/include/tlogger.h index 4c59de9..7932ec1 100644 --- a/toonz/sources/include/tlogger.h +++ b/toonz/sources/include/tlogger.h @@ -1,8 +1,8 @@ - - #ifndef TLOGGER_INCLUDED #define TLOGGER_INCLUDED +#include + // // TLogger // @@ -34,7 +34,7 @@ class TFilePath; class DVAPI TLogger { // singleton class Imp; - Imp *m_imp; + std::unique_ptr m_imp; TLogger(); diff --git a/toonz/sources/include/tmeshimage.h b/toonz/sources/include/tmeshimage.h index a83d756..5c84e12 100644 --- a/toonz/sources/include/tmeshimage.h +++ b/toonz/sources/include/tmeshimage.h @@ -1,8 +1,8 @@ - - #ifndef TMESHIMAGE_INCLUDED #define TMESHIMAGE_INCLUDED +#include + // TnzCore includes #include "tsmartpointer.h" #include "tpersist.h" @@ -172,14 +172,14 @@ struct graph_traits class DVAPI TMeshImage : public TImage { class Imp; - Imp *m_imp; + std::shared_ptr m_imp; public: typedef std::vector meshes_container; public: TMeshImage(); - TMeshImage(Imp *imp); + TMeshImage(std::shared_ptr imp); ~TMeshImage(); TMeshImage(const TMeshImage &other); diff --git a/toonz/sources/include/tnotanimatableparam.h b/toonz/sources/include/tnotanimatableparam.h index 1f5ad86..b4cab57 100644 --- a/toonz/sources/include/tnotanimatableparam.h +++ b/toonz/sources/include/tnotanimatableparam.h @@ -1,8 +1,8 @@ - - #ifndef TNOTANIMATABLEPARAM_H #define TNOTANIMATABLEPARAM_H +#include + #include "tparam.h" #include "tparamchange.h" #include "tfilepath.h" @@ -331,7 +331,7 @@ public: void saveData(TOStream &os); private: - TEnumParamImp *m_imp; + std::unique_ptr m_imp; }; typedef TEnumParam TIntEnumParam; diff --git a/toonz/sources/include/tofflinegl.h b/toonz/sources/include/tofflinegl.h index a7cf984..3049b8b 100644 --- a/toonz/sources/include/tofflinegl.h +++ b/toonz/sources/include/tofflinegl.h @@ -1,10 +1,8 @@ - - #ifndef TOFFLINEGL_INCLUDED #define TOFFLINEGL_INCLUDED -//#include "trasterimage.h" -//#include "tvectorimage.h" +#include + #include "tgl.h" #undef DVAPI @@ -47,12 +45,12 @@ public: virtual ~Imp(){}; virtual void makeCurrent() = 0; virtual void doneCurrent() = 0; // Da implementare in Imp - virtual void createContext(TDimension rasterSize, const TOfflineGL::Imp *shared) = 0; + virtual void createContext(TDimension rasterSize, std::shared_ptr shared) = 0; virtual void getRaster(TRaster32P) = 0; virtual int getLx() const { return m_lx; } virtual int getLy() const { return m_ly; } }; - typedef Imp *ImpGenerator(const TDimension &dim, const TOfflineGL::Imp *shared); + typedef std::shared_ptr ImpGenerator(const TDimension &dim, std::shared_ptr shared); static ImpGenerator *defineImpGenerator(ImpGenerator *impGenerator); TOfflineGL(TDimension dim, const TOfflineGL *shared = 0); @@ -87,7 +85,7 @@ public: static TOfflineGL *getStock(TDimension dim); // si usa cosi': TOfflineGL *ogl = TOfflineGL::getStock(d); // non bisogna liberare ogl - Imp *m_imp; + std::shared_ptr m_imp; private: private: diff --git a/toonz/sources/include/tools/strokeselection.h b/toonz/sources/include/tools/strokeselection.h index a6391ca..fb5265a 100644 --- a/toonz/sources/include/tools/strokeselection.h +++ b/toonz/sources/include/tools/strokeselection.h @@ -1,8 +1,8 @@ - - #ifndef STROKE_SELECTION_H #define STROKE_SELECTION_H +#include + // TnzQt includes #include "toonzqt/selection.h" @@ -10,9 +10,6 @@ #include "tcommon.h" #include "tvectorimage.h" -// boost includes -#include - // STD includes #include @@ -88,7 +85,7 @@ private: TVectorImageP m_vi; //!< Selected vector image. IndexesContainer m_indexes; //!< Selected stroke indexes in m_vi. - boost::scoped_ptr m_groupCommand; //!< Groups commands wrapper. + std::unique_ptr m_groupCommand; //!< Groups commands wrapper. TSceneHandle *m_sceneHandle; //!< Global scene handle. \deprecated Use TApplication instead. /*!Set this boolean to true before call tool->notifyImageChanged() when you want to reset strokes bbox. diff --git a/toonz/sources/include/toonz/autoclose.h b/toonz/sources/include/toonz/autoclose.h index 1d67bdc..3465d50 100644 --- a/toonz/sources/include/toonz/autoclose.h +++ b/toonz/sources/include/toonz/autoclose.h @@ -1,8 +1,8 @@ - - #ifndef _TAUTOCLOSE_H_ #define _TAUTOCLOSE_H_ +#include + #include "tgeometry.h" #include "traster.h" @@ -35,7 +35,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; //not implemented TAutocloser(); diff --git a/toonz/sources/include/toonz/imagemanager.h b/toonz/sources/include/toonz/imagemanager.h index a8b9e78..273c056 100644 --- a/toonz/sources/include/toonz/imagemanager.h +++ b/toonz/sources/include/toonz/imagemanager.h @@ -1,8 +1,8 @@ - - #ifndef IMAGEMANAGER_H #define IMAGEMANAGER_H +#include + // TnzCore includes #include "timage.h" #include "timageinfo.h" @@ -170,7 +170,7 @@ public: private: struct Imp; - Imp *m_imp; + std::unique_ptr m_imp; private: ImageManager(); diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 70bcb27..045d1df 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -1,8 +1,8 @@ - - #ifndef PREFERENCES_H #define PREFERENCES_H +#include + // TnzCore includes #include "tcommon.h" #include "tgeometry.h" @@ -17,9 +17,6 @@ #include #include -// boost includes -#include - #undef DVAPI #undef DVVAR #ifdef TOONZLIB_EXPORTS @@ -431,7 +428,7 @@ public: void startAutoSave(); private: - boost::scoped_ptr m_settings; + std::unique_ptr m_settings; QMap m_languageMaps, m_styleSheetMaps; diff --git a/toonz/sources/include/toonz/tlog.h b/toonz/sources/include/toonz/tlog.h index f2a1b3d..3f3fc16 100644 --- a/toonz/sources/include/toonz/tlog.h +++ b/toonz/sources/include/toonz/tlog.h @@ -1,8 +1,8 @@ - - #ifndef TSYSLOG_H #define TSYSLOG_H +#include + #include "tcommon.h" class TFilePath; @@ -39,7 +39,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; }; #endif diff --git a/toonz/sources/include/toonz/tstageobjecttree.h b/toonz/sources/include/toonz/tstageobjecttree.h index 1d852a8..575e0a2 100644 --- a/toonz/sources/include/toonz/tstageobjecttree.h +++ b/toonz/sources/include/toonz/tstageobjecttree.h @@ -1,8 +1,8 @@ - - #ifndef T_STAGE_OBJECT_TREE_INCLUDED #define T_STAGE_OBJECT_TREE_INCLUDED +#include + #include "toonz/tstageobject.h" #undef DVAPI @@ -70,7 +70,7 @@ class DVAPI TStageObjectTree : public TPersist { PERSIST_DECLARATION(TStageObjectTree) struct TStageObjectTreeImp; - TStageObjectTreeImp *m_imp; + std::unique_ptr m_imp; // usato solo sotto #ifndef NDEBUG void checkIntegrity(); diff --git a/toonz/sources/include/toonz/txsheet.h b/toonz/sources/include/toonz/txsheet.h index 8b5cfb4..ee91d06 100644 --- a/toonz/sources/include/toonz/txsheet.h +++ b/toonz/sources/include/toonz/txsheet.h @@ -1,8 +1,8 @@ - - #ifndef XSHEET_INCLUDED #define XSHEET_INCLUDED +#include + // TnzCore includes #include "traster.h" #include "tpersist.h" @@ -118,7 +118,7 @@ private: The TXsheetImp struct provides all objects necessary to define the \b TXsheet class. */ struct TXsheetImp; - TXsheetImp *m_imp; + std::unique_ptr m_imp; TXshNoteSet *m_notes; SoundProperties *m_soundProperties; diff --git a/toonz/sources/include/toonz/txshsimplelevel.h b/toonz/sources/include/toonz/txshsimplelevel.h index 2774172..93eadb1 100644 --- a/toonz/sources/include/toonz/txshsimplelevel.h +++ b/toonz/sources/include/toonz/txshsimplelevel.h @@ -1,8 +1,8 @@ - - #ifndef TXSHSIMPLELEVEL_INCLUDED #define TXSHSIMPLELEVEL_INCLUDED +#include + // TnzLib includes #include "toonz/txshlevel.h" #include "toonz/txshleveltypes.h" @@ -17,7 +17,6 @@ #include // boost includes -#include #include #include @@ -322,10 +321,8 @@ private: typedef boost::container::flat_set FramesSet; private: - boost:: - scoped_ptr m_properties; - boost:: - scoped_ptr m_contentHistory; + std::unique_ptr m_properties; + std::unique_ptr m_contentHistory; TPalette *m_palette; diff --git a/toonz/sources/include/toonzqt/infoviewer.h b/toonz/sources/include/toonzqt/infoviewer.h index 36638b9..a8286db 100644 --- a/toonz/sources/include/toonzqt/infoviewer.h +++ b/toonz/sources/include/toonzqt/infoviewer.h @@ -1,8 +1,8 @@ - - #ifndef INFOVIEWER_H #define INFOVIEWER_H +#include + #include "toonzqt/dvdialog.h" #undef DVAPI @@ -23,7 +23,7 @@ class InfoViewerImp; class DVAPI InfoViewer : public DVGui::Dialog { Q_OBJECT - InfoViewerImp *m_imp; + std::unique_ptr m_imp; QWidget *m_parent; public: diff --git a/toonz/sources/include/tparamcontainer.h b/toonz/sources/include/tparamcontainer.h index 49deaa0..570ac68 100644 --- a/toonz/sources/include/tparamcontainer.h +++ b/toonz/sources/include/tparamcontainer.h @@ -1,8 +1,8 @@ - - #ifndef TPARAMCONTAINER_INCLUDED #define TPARAMCONTAINER_INCLUDED +#include + #include "tparam.h" //#include "tfx.h" #include "tcommon.h" @@ -69,7 +69,7 @@ public: class DVAPI TParamContainer { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TParamContainer(); diff --git a/toonz/sources/include/tparser.h b/toonz/sources/include/tparser.h index 5fb0e2e..4b8a093 100644 --- a/toonz/sources/include/tparser.h +++ b/toonz/sources/include/tparser.h @@ -1,8 +1,8 @@ - - #ifndef TPARSER_INCLUDED #define TPARSER_INCLUDED +#include + #include "tcommon.h" #include "tgrammar.h" @@ -27,7 +27,7 @@ struct DVAPI SyntaxToken { class DVAPI Parser { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: Parser(const Grammar *grammar); diff --git a/toonz/sources/include/tpredictivecachemanager.h b/toonz/sources/include/tpredictivecachemanager.h index b3a8bf2..bdf0a7c 100644 --- a/toonz/sources/include/tpredictivecachemanager.h +++ b/toonz/sources/include/tpredictivecachemanager.h @@ -1,8 +1,8 @@ - - #ifndef TPREDICTIVECACHEMANAGER_H #define TPREDICTIVECACHEMANAGER_H +#include + #include "tfxcachemanager.h" #include "tgeometry.h" @@ -35,7 +35,7 @@ class DVAPI TPredictiveCacheManager T_RENDER_RESOURCE_MANAGER class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TPredictiveCacheManager(); diff --git a/toonz/sources/include/tregion.h b/toonz/sources/include/tregion.h index 56568f3..2ac3e02 100644 --- a/toonz/sources/include/tregion.h +++ b/toonz/sources/include/tregion.h @@ -1,11 +1,11 @@ - - //----------------------------------------------------------------------------- // tregion.h: interface for the TRegion class. //----------------------------------------------------------------------------- #if !defined(TREGION_H) #define TREGION_H +#include + #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 @@ -165,7 +165,7 @@ typedef TSmartPointerT TEdgeP; class DVAPI TRegion { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: TRegion(); diff --git a/toonz/sources/include/trop_borders.h b/toonz/sources/include/trop_borders.h index ef75e63..c58359e 100644 --- a/toonz/sources/include/trop_borders.h +++ b/toonz/sources/include/trop_borders.h @@ -1,8 +1,8 @@ - - #ifndef TROP_BORDERS_H #define TROP_BORDERS_H +#include + // TnzCore includes #include "tsmartpointer.h" #include "tgeometry.h" @@ -159,7 +159,7 @@ typedef TSmartPointerT ImageMeshP; class DVAPI ImageMeshesReader { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: ImageMeshesReader(); diff --git a/toonz/sources/include/tsmartpointer.h b/toonz/sources/include/tsmartpointer.h index 8133dcd..346f1c0 100644 --- a/toonz/sources/include/tsmartpointer.h +++ b/toonz/sources/include/tsmartpointer.h @@ -1,8 +1,8 @@ - - #ifndef TSMARTPOINTER_INCLUDED #define TSMARTPOINTER_INCLUDED +#include + #include "tutil.h" #include "tatomicvar.h" @@ -115,7 +115,7 @@ class DVAPI TSmartPointerT { protected: - T *m_pointer; + T* m_pointer; public: TSmartPointerT() : m_pointer(0) {} @@ -126,7 +126,7 @@ public: m_pointer->addRef(); } - TSmartPointerT(T *pointer) : m_pointer(pointer) + TSmartPointerT(T* pointer) : m_pointer(pointer) { if (m_pointer) m_pointer->addRef(); diff --git a/toonz/sources/include/tsound.h b/toonz/sources/include/tsound.h index 0cd52da..1920805 100644 --- a/toonz/sources/include/tsound.h +++ b/toonz/sources/include/tsound.h @@ -1,8 +1,8 @@ - - #ifndef TSOUND_INCLUDED #define TSOUND_INCLUDED +#include + #include "tsmartpointer.h" #include "texception.h" #include "tthreadmessage.h" @@ -285,7 +285,7 @@ class TSoundInputDeviceImp; */ class DVAPI TSoundInputDevice { - TSoundInputDeviceImp *m_imp; + std::shared_ptr m_imp; public: enum Source { @@ -360,7 +360,7 @@ class TSoundOutputDeviceImp; */ class DVAPI TSoundOutputDevice { - TSoundOutputDeviceImp *m_imp; + std::shared_ptr m_imp; public: TSoundOutputDevice(); diff --git a/toonz/sources/include/tspectrumparam.h b/toonz/sources/include/tspectrumparam.h index 31be476..6ea7433 100644 --- a/toonz/sources/include/tspectrumparam.h +++ b/toonz/sources/include/tspectrumparam.h @@ -1,8 +1,8 @@ - - #ifndef TSPECTRUMPARAM_H #define TSPECTRUMPARAM_H +#include + #include "tspectrum.h" #include "tparamset.h" @@ -37,7 +37,7 @@ class DVAPI TSpectrumParam : public TParam { PERSIST_DECLARATION(TSpectrumParam) - TSpectrumParamImp *m_imp; + std::unique_ptr m_imp; public: TSpectrumParam(); diff --git a/toonz/sources/include/tstencilcontrol.h b/toonz/sources/include/tstencilcontrol.h index f8f45c4..4eb63c9 100644 --- a/toonz/sources/include/tstencilcontrol.h +++ b/toonz/sources/include/tstencilcontrol.h @@ -1,8 +1,8 @@ - - #ifndef TSTENCILCONTROL_H #define TSTENCILCONTROL_H +#include + #include "tcommon.h" #undef DVAPI @@ -34,7 +34,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: static TStencilControl *instance(); diff --git a/toonz/sources/include/tstream.h b/toonz/sources/include/tstream.h index ddb5cbd..4f9b412 100644 --- a/toonz/sources/include/tstream.h +++ b/toonz/sources/include/tstream.h @@ -1,8 +1,8 @@ - - #ifndef TSTREAM_H #define TSTREAM_H +#include + // TnzCore includes #include "tpixel.h" @@ -44,7 +44,7 @@ typedef std::pair VersionNumber; //!< Integer pair storing the major a class DVAPI TIStream { class Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: /*! @@ -168,10 +168,10 @@ TIStream &operator>>(TIStream &is, T *&v) class DVAPI TOStream { class Imp; - Imp *m_imp; + std::shared_ptr m_imp; private: - TOStream(Imp *imp); //!< deprecated + TOStream(std::shared_ptr imp); //!< deprecated public: /*! @@ -238,8 +238,8 @@ public: private: // Not copyable - TOStream(const TOStream &); //!< Not implemented - TOStream &operator=(const TOStream &); //!< Not implemented + TOStream(const TOStream &) = default; //!< Not implemented + TOStream &operator=(const TOStream &) = delete; //!< Not implemented }; #endif // TSTREAM_H diff --git a/toonz/sources/include/tstroke.h b/toonz/sources/include/tstroke.h index 2a93848..9d739d5 100644 --- a/toonz/sources/include/tstroke.h +++ b/toonz/sources/include/tstroke.h @@ -1,8 +1,8 @@ - - #ifndef TSTROKE_H #define TSTROKE_H +#include + #include "tsmartpointer.h" #include "tgeometry.h" #include "tthreadmessage.h" @@ -50,7 +50,7 @@ class DVAPI TStroke : public TSmartObject private: //! Pimpl of a TStroke struct Imp; - Imp *m_imp; + std::unique_ptr m_imp; public: struct OutlineOptions; diff --git a/toonz/sources/include/ttcpip.h b/toonz/sources/include/ttcpip.h index 693dd15..adfcb6a 100644 --- a/toonz/sources/include/ttcpip.h +++ b/toonz/sources/include/ttcpip.h @@ -1,8 +1,8 @@ - - #ifndef TTCPIP_H #define TTCPIP_H +#include + #include "tcommon.h" #include @@ -48,7 +48,7 @@ public: int getExitCode() const; private: - TTcpIpServerImp *m_imp; + std::shared_ptr m_imp; }; //--------------------------------------------------------------------- diff --git a/toonz/sources/include/ttimer.h b/toonz/sources/include/ttimer.h index 2de2d26..4aaa949 100644 --- a/toonz/sources/include/ttimer.h +++ b/toonz/sources/include/ttimer.h @@ -1,8 +1,8 @@ - - #ifndef TTIMER_INCLUDED #define TTIMER_INCLUDED +#include + #include "tcommon.h" #undef DVAPI @@ -98,7 +98,7 @@ public: class Imp; private: - Imp *m_imp; + std::unique_ptr m_imp; TTimer(const TTimer &); void operator=(const TTimer &); diff --git a/toonz/sources/include/tundo.h b/toonz/sources/include/tundo.h index df58017..d0f5715 100644 --- a/toonz/sources/include/tundo.h +++ b/toonz/sources/include/tundo.h @@ -1,8 +1,8 @@ - - #ifndef T_UNDO_INCLUDED #define T_UNDO_INCLUDED +#include + // TnzCore includes #include "tsmartpointer.h" @@ -103,7 +103,7 @@ public: private: struct TUndoManagerImp; - TUndoManagerImp *m_imp; + std::unique_ptr m_imp; private: // Noncopyable diff --git a/toonz/sources/include/tvectorimage.h b/toonz/sources/include/tvectorimage.h index 8fb1234..f80f239 100644 --- a/toonz/sources/include/tvectorimage.h +++ b/toonz/sources/include/tvectorimage.h @@ -1,8 +1,8 @@ - - #ifndef TVECTORIMAGE_INCLUDED #define TVECTORIMAGE_INCLUDED +#include + #include "timage.h" // da togliere spostando cose in altri file!! @@ -60,7 +60,7 @@ class DVAPI TVectorImage : public TImage int pickGroup(const TPointD &pos, bool onEnteredGroup) const; public: - Imp *m_imp; + std::unique_ptr m_imp; struct IntersectionBranch { int m_strokeIndex; diff --git a/toonz/sources/stdfx/shadingcontext.cpp b/toonz/sources/stdfx/shadingcontext.cpp index 2a82a5b..c26fe32 100644 --- a/toonz/sources/stdfx/shadingcontext.cpp +++ b/toonz/sources/stdfx/shadingcontext.cpp @@ -120,7 +120,6 @@ ShadingContext::ShadingContext() ShadingContext::~ShadingContext() { - delete m_imp; } //-------------------------------------------------------- diff --git a/toonz/sources/tnzbase/permissionsmanager.cpp b/toonz/sources/tnzbase/permissionsmanager.cpp index 9524e0c..635d717 100644 --- a/toonz/sources/tnzbase/permissionsmanager.cpp +++ b/toonz/sources/tnzbase/permissionsmanager.cpp @@ -161,15 +161,14 @@ void PermissionsManager::Imp::loadPermissions() //========================================================= PermissionsManager::PermissionsManager() + : m_imp(new Imp()) { - m_imp = new Imp(); } //--------------------------------------------------------- PermissionsManager::~PermissionsManager() { - delete m_imp; } //--------------------------------------------------------- diff --git a/toonz/sources/tnzext/meshtexturizer.cpp b/toonz/sources/tnzext/meshtexturizer.cpp index 576c202..16f8557 100644 --- a/toonz/sources/tnzext/meshtexturizer.cpp +++ b/toonz/sources/tnzext/meshtexturizer.cpp @@ -1,4 +1,4 @@ - +#include #include "ext/meshtexturizer.h" @@ -15,10 +15,6 @@ #include "tcg/tcg_list.h" #include "tcg/tcg_misc.h" -// Boost includes -#include -#include - #define COPIED_BORDER 1 // Amount of tile border from the original image #define TRANSP_BORDER 1 // Amount of transparent tile border #define NONPREM_BORDER 1 // Amount of nonpremultiplied copied transparent border @@ -39,7 +35,7 @@ class MeshTexturizer::Imp public: QReadWriteLock m_lock; //!< Lock for synchronized access - tcg::list> m_textureDatas; //!< Pool of texture datas + tcg::list> m_textureDatas; //!< Pool of texture datas public: Imp() : m_lock(QReadWriteLock::Recursive) {} @@ -216,7 +212,6 @@ MeshTexturizer::MeshTexturizer() MeshTexturizer::~MeshTexturizer() { - delete m_imp; } //--------------------------------------------------------------------------------- @@ -232,7 +227,7 @@ int MeshTexturizer::bindTexture(const TRaster32P &ras, const TRectD &geom, glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); // Initialize a new texture data - int dataIdx = m_imp->m_textureDatas.push_back(boost::make_shared(geom)); + int dataIdx = m_imp->m_textureDatas.push_back(std::make_shared(geom)); // Textures must have 2-power sizes. So, let's start with the smallest 2 power // >= ras's sizes. diff --git a/toonz/sources/tnzext/plasticdeformer.cpp b/toonz/sources/tnzext/plasticdeformer.cpp index bdab0f4..8e6ed29 100644 --- a/toonz/sources/tnzext/plasticdeformer.cpp +++ b/toonz/sources/tnzext/plasticdeformer.cpp @@ -889,7 +889,6 @@ PlasticDeformer::PlasticDeformer() PlasticDeformer::~PlasticDeformer() { - delete m_imp; } //--------------------------------------------------------------------------------- diff --git a/toonz/sources/tnzext/plasticdeformerstorage.cpp b/toonz/sources/tnzext/plasticdeformerstorage.cpp index 8960aa3..572b266 100644 --- a/toonz/sources/tnzext/plasticdeformerstorage.cpp +++ b/toonz/sources/tnzext/plasticdeformerstorage.cpp @@ -1,4 +1,4 @@ - +#include // TnzExt includes #include "ext/plasticskeleton.h" @@ -10,9 +10,6 @@ #include // Boost includes -#include -#include - #include #include #include @@ -42,7 +39,7 @@ struct Key { const TMeshImage *m_mi; DeformedSkeleton m_ds; - boost::shared_ptr m_dataGroup; + std::shared_ptr m_dataGroup; public: Key(const TMeshImage *mi, const SkD *sd, int skelId) @@ -448,7 +445,6 @@ PlasticDeformerStorage::PlasticDeformerStorage() PlasticDeformerStorage::~PlasticDeformerStorage() { - delete m_imp; } //---------------------------------------------------------------------------------- @@ -472,7 +468,7 @@ PlasticDeformerDataGroup *PlasticDeformerStorage::deformerData( DeformersByKey::iterator dt = m_imp->m_deformers.find(key); if (dt == m_imp->m_deformers.end()) { // No deformer was found. Allocate it. - key.m_dataGroup = boost::make_shared(); + key.m_dataGroup = std::make_shared(); initializeDeformersData(key.m_dataGroup.get(), meshImage); dt = m_imp->m_deformers.insert(key).first; diff --git a/toonz/sources/tnzext/plasticskeleton.cpp b/toonz/sources/tnzext/plasticskeleton.cpp index 5b909ed..1130b29 100644 --- a/toonz/sources/tnzext/plasticskeleton.cpp +++ b/toonz/sources/tnzext/plasticskeleton.cpp @@ -103,12 +103,8 @@ public: Imp(const Imp &other); Imp &operator=(const Imp &other); -#ifndef BOOST_NO_RVALUE_REFERENCES - Imp(Imp &&other); Imp &operator=(Imp &&other); - -#endif }; //=============================================================================== @@ -127,9 +123,6 @@ PlasticSkeleton::Imp &PlasticSkeleton::Imp::operator=(const Imp &other) } //------------------------------------------------------------------------------- - -#ifndef BOOST_NO_RVALUE_REFERENCES - PlasticSkeleton::Imp::Imp(Imp &&other) : m_numbersPool(std::move(other.m_numbersPool)) { @@ -143,8 +136,6 @@ PlasticSkeleton::Imp &PlasticSkeleton::Imp::operator=(Imp &&other) return *this; } -#endif - //************************************************************************************ // PlasticSkeleton implementation //************************************************************************************ @@ -158,7 +149,6 @@ PlasticSkeleton::PlasticSkeleton() PlasticSkeleton::~PlasticSkeleton() { - delete m_imp; } //------------------------------------------------------------------ @@ -181,9 +171,6 @@ PlasticSkeleton &PlasticSkeleton::operator=(const PlasticSkeleton &other) } //------------------------------------------------------------------ - -#ifndef BOOST_NO_RVALUE_REFERENCES - PlasticSkeleton::PlasticSkeleton(PlasticSkeleton &&other) : mesh_type(std::forward(other)), m_imp(new Imp(std::move(*other.m_imp))) { @@ -201,8 +188,6 @@ PlasticSkeleton &PlasticSkeleton::operator=(PlasticSkeleton &&other) return *this; } -#endif - //------------------------------------------------------------------ void PlasticSkeleton::addListener(PlasticSkeletonDeformation *deformation) diff --git a/toonz/sources/tnzext/plasticskeletondeformation.cpp b/toonz/sources/tnzext/plasticskeletondeformation.cpp index 201d616..4a248a3 100644 --- a/toonz/sources/tnzext/plasticskeletondeformation.cpp +++ b/toonz/sources/tnzext/plasticskeletondeformation.cpp @@ -644,8 +644,6 @@ PlasticSkeletonDeformation::~PlasticSkeletonDeformation() SkeletonSet::iterator st, sEnd(m_imp->m_skeletons.end()); for (st = m_imp->m_skeletons.begin(); st != sEnd; ++st) st->get_right()->removeListener(this); - - delete m_imp; } //------------------------------------------------------------------ diff --git a/toonz/sources/tnzext/ttexturesstorage.cpp b/toonz/sources/tnzext/ttexturesstorage.cpp index 48e047e..7d369ae 100644 --- a/toonz/sources/tnzext/ttexturesstorage.cpp +++ b/toonz/sources/tnzext/ttexturesstorage.cpp @@ -1,4 +1,4 @@ - +#include // TnzCore includes #include "tgl.h" @@ -9,9 +9,6 @@ // tcg includes #include "tcg/tcg_list.h" -// Boost includes -#include - // Qt includes #include #include @@ -150,7 +147,7 @@ DrawableTextureDataP TTexturesStorage::loadTexture( MeshTexturizer &texturizer = it->second->m_texturizer; - DrawableTextureDataP dataPtr = boost::make_shared(); + DrawableTextureDataP dataPtr = std::make_shared(); DrawableTextureData *data = dataPtr.get(); data->m_dlSpaceId = dlSpaceId; diff --git a/toonz/sources/toonz/cleanuppopup.h b/toonz/sources/toonz/cleanuppopup.h index cef7ffd..349cd3a 100644 --- a/toonz/sources/toonz/cleanuppopup.h +++ b/toonz/sources/toonz/cleanuppopup.h @@ -1,8 +1,8 @@ - - #ifndef CLEANUPPOPUP_H #define CLEANUPPOPUP_H +#include + // TnzQt includes #include "toonzqt/validatedchoicedialog.h" @@ -11,7 +11,6 @@ #include "timage.h" // boost includes -#include #include #include @@ -73,7 +72,7 @@ private: QPushButton *m_cleanupButton; QPushButton *m_skipButton; - boost::scoped_ptr + std::unique_ptr m_updater; //!< The cleanup level updater. bc::vector m_cleanupLevels; //!< List of levels to be cleanupped. @@ -84,10 +83,10 @@ private: std::vector m_cleanuppedLevelFrames; //!< Current level's list of cleanupped frames. Used //! to selectively build the level's unpainted backup. - boost::scoped_ptr + std::unique_ptr m_params; //!< Cleanup params used to cleanup. - boost::scoped_ptr + std::unique_ptr m_overwriteDialog; //!< Dialog about level overwriting options. /* Palette上書きの判断をするために、保存先Levelが既に存在するかどうかのフラグ diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp index 48396dc..8ab77b4 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -1,4 +1,4 @@ - +#include #include "iocommand.h" @@ -2177,7 +2177,7 @@ int loadPSDResource(IoCmd::LoadResourceArguments &args, bool updateRecentFile, P typedef IoCmd::LoadResourceArguments::ScopedBlock LoadScopedBlock; struct LoadScopedBlock::Data { - boost::scoped_ptr + std::unique_ptr m_progressDialog; //!< Progress dialog displayed on multiple paths. int m_loadedCount; //!< Number of loaded levels. bool m_hasSoundLevel; //!< Whether a sound level was loaded. diff --git a/toonz/sources/toonz/iocommand.h b/toonz/sources/toonz/iocommand.h index c8b4591..825b8ad 100644 --- a/toonz/sources/toonz/iocommand.h +++ b/toonz/sources/toonz/iocommand.h @@ -1,8 +1,8 @@ - - #ifndef IOCOMMAND_H #define IOCOMMAND_H +#include + // TnzLib includes #include "toonz/preferences.h" @@ -14,7 +14,6 @@ #include // boost includes -#include #include // STD includes @@ -73,7 +72,7 @@ struct LoadResourceArguments { Data &data() const { return *m_data; } //!< Internal data used by the loading procedure. private: - boost::scoped_ptr m_data; + std::unique_ptr m_data; }; struct ResourceData //! Data about a single resource to be loaded. diff --git a/toonz/sources/toonz/moviegenerator.cpp b/toonz/sources/toonz/moviegenerator.cpp index a73b2a9..d3ae184 100644 --- a/toonz/sources/toonz/moviegenerator.cpp +++ b/toonz/sources/toonz/moviegenerator.cpp @@ -458,12 +458,11 @@ MovieGenerator::MovieGenerator( const TDimension &resolution, TOutputProperties &outputProperties, bool useMarkers) - : m_imp(0) { if (path.getType() == "swf" || path.getType() == "scr") - m_imp = new FlashMovieGenerator(path, resolution, outputProperties); + m_imp.reset(new FlashMovieGenerator(path, resolution, outputProperties)); else - m_imp = new RasterMovieGenerator(path, resolution, outputProperties); + m_imp.reset(new RasterMovieGenerator(path, resolution, outputProperties)); m_imp->m_useMarkers = useMarkers; } @@ -471,7 +470,6 @@ MovieGenerator::MovieGenerator( MovieGenerator::~MovieGenerator() { - delete m_imp; } //------------------------------------------------------------------- @@ -508,7 +506,7 @@ bool MovieGenerator::addSoundtrack(const ToonzScene &scene, int frameOffset, int bool MovieGenerator::addScene(ToonzScene &scene, int r0, int r1) { TApp *app = TApp::instance(); - RasterMovieGenerator *imp = dynamic_cast(m_imp); + RasterMovieGenerator *imp = dynamic_cast(m_imp.get()); if (imp) imp->m_alphaEnabled = true; m_imp->m_renderRange = std::make_pair(r0, r1); diff --git a/toonz/sources/toonz/moviegenerator.h b/toonz/sources/toonz/moviegenerator.h index a0666d2..84717e1 100644 --- a/toonz/sources/toonz/moviegenerator.h +++ b/toonz/sources/toonz/moviegenerator.h @@ -1,8 +1,8 @@ - - #ifndef MOVIEGENERATOR_INCLUDED #define MOVIEGENERATOR_INCLUDED +#include + #include "tfilepath.h" #include "tpixel.h" #include "tgeometry.h" @@ -26,7 +26,7 @@ public: class Imp; private: - Imp *m_imp; + std::unique_ptr m_imp; public: class Listener diff --git a/toonz/sources/toonz/previewer.cpp b/toonz/sources/toonz/previewer.cpp index 97fbeca..79b3220 100644 --- a/toonz/sources/toonz/previewer.cpp +++ b/toonz/sources/toonz/previewer.cpp @@ -1018,7 +1018,6 @@ Previewer::Previewer(bool subcamera) Previewer::~Previewer() { - delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/previewer.h b/toonz/sources/toonz/previewer.h index 3324e34..7b20e80 100644 --- a/toonz/sources/toonz/previewer.h +++ b/toonz/sources/toonz/previewer.h @@ -1,8 +1,8 @@ - - #ifndef PREVIEWER_INCLUDED #define PREVIEWER_INCLUDED +#include + #include "traster.h" #include "tfx.h" @@ -31,7 +31,7 @@ class Previewer : public QObject, public TFxObserver Q_OBJECT class Imp; - Imp *m_imp; + std::unique_ptr m_imp; Previewer(bool subcamera); ~Previewer(); diff --git a/toonz/sources/toonz/vectorizerpopup.h b/toonz/sources/toonz/vectorizerpopup.h index 7de3e4a..75cf3c1 100644 --- a/toonz/sources/toonz/vectorizerpopup.h +++ b/toonz/sources/toonz/vectorizerpopup.h @@ -1,8 +1,8 @@ - - #ifndef VECTORIZERPOPUP_H #define VECTORIZERPOPUP_H +#include + // TnzCore includes #include "tvectorimage.h" @@ -13,9 +13,6 @@ // TnzQt includes #include "toonzqt/dvdialog.h" -// boost includes -#include - // Qt includes #include #include @@ -301,7 +298,7 @@ private: TXshSimpleLevelP m_vLevel; //!< Output vectorized level std::vector m_fids; //!< Frame ids of the input \b m_level - boost::scoped_ptr + std::unique_ptr m_dialog; //!< Dialog to be shown for overwrite resolution. bool m_isCanceled, //!< User cancels set this flag to true diff --git a/toonz/sources/toonzfarm/include/service.h b/toonz/sources/toonzfarm/include/service.h index 2edc4dc..5e20d3d 100644 --- a/toonz/sources/toonzfarm/include/service.h +++ b/toonz/sources/toonzfarm/include/service.h @@ -1,9 +1,7 @@ - - #ifndef SERVICE_H #define SERVICE_H -//#include "tfilepath.h" +#include class TFilePath; @@ -86,7 +84,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; static TService *m_instance; }; diff --git a/toonz/sources/toonzfarm/include/tlog.h b/toonz/sources/toonzfarm/include/tlog.h index 2d0e318..a489eea 100644 --- a/toonz/sources/toonzfarm/include/tlog.h +++ b/toonz/sources/toonzfarm/include/tlog.h @@ -1,8 +1,8 @@ - - #ifndef TSYSLOG_H #define TSYSLOG_H +#include + #include "tcommon.h" #include @@ -45,7 +45,7 @@ public: private: class Imp; - Imp *m_imp; + std::unique_ptr m_imp; }; #endif diff --git a/toonz/sources/toonzfarm/tfarm/service.cpp b/toonz/sources/toonzfarm/tfarm/service.cpp index 84403ac..7fcc4eb 100644 --- a/toonz/sources/toonzfarm/tfarm/service.cpp +++ b/toonz/sources/toonzfarm/tfarm/service.cpp @@ -123,7 +123,6 @@ TService::TService(const string &name, const string &displayName) TService::~TService() { - delete m_imp; } //------------------------------------------------------------------------------ diff --git a/toonz/sources/toonzfarm/tfarm/tfarmserverstub.cpp b/toonz/sources/toonzfarm/tfarm/tfarmserverstub.cpp index b597002..527f83a 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmserverstub.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmserverstub.cpp @@ -106,7 +106,6 @@ TFarmServerStub::TFarmServerStub(TFarmServer *farmServer, int port) TFarmServerStub::~TFarmServerStub() { - delete m_imp; } //------------------------------------------------------------------------------ diff --git a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp index 04fb70e..2e366c9 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp @@ -697,7 +697,6 @@ TFarmTaskGroup::TFarmTaskGroup(const TFarmTaskGroup &src) TFarmTaskGroup::~TFarmTaskGroup() { - delete m_imp; } //------------------------------------------------------------------------------ diff --git a/toonz/sources/toonzfarm/tfarm/tlog.cpp b/toonz/sources/toonzfarm/tfarm/tlog.cpp index 23309bd..1c7457c 100644 --- a/toonz/sources/toonzfarm/tfarm/tlog.cpp +++ b/toonz/sources/toonzfarm/tfarm/tlog.cpp @@ -201,7 +201,6 @@ TUserLog::TUserLog(const TFilePath &fp) : m_imp(new Imp(fp)) TUserLog::~TUserLog() { - delete m_imp; } //------------------------------------------------------------------------------ diff --git a/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp b/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp index b7f7cb7..8b200ce 100644 --- a/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp +++ b/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp @@ -268,7 +268,6 @@ TTcpIpServer::~TTcpIpServer() std::cout << "closing socket" << std::endl; close(m_imp->m_s); #endif - delete m_imp; } //--------------------------------------------------------------------- @@ -290,14 +289,13 @@ static void shutdown_cb(int) class DataReader : public TThread::Runnable { public: - DataReader(int clientSocket, TTcpIpServer *server, TTcpIpServerImp *serverImp) - : m_clientSocket(clientSocket), m_server(server), m_serverImp(serverImp) {} + DataReader(int clientSocket, std::shared_ptr serverImp) + : m_clientSocket(clientSocket), m_serverImp(std::move(serverImp)) {} void run(); int m_clientSocket; - TTcpIpServer *m_server; - TTcpIpServerImp *m_serverImp; + std::shared_ptr m_serverImp; }; void DataReader::run() @@ -322,15 +320,14 @@ void DataReader::run() class DataReceiver : public TThread::Runnable { public: - DataReceiver(int clientSocket, const QString &data, TTcpIpServer *server, TTcpIpServerImp *serverImp) - : m_clientSocket(clientSocket), m_data(data), m_server(server), m_serverImp(serverImp) {} + DataReceiver(int clientSocket, const QString &data, std::shared_ptr serverImp) + : m_clientSocket(clientSocket), m_data(data), m_serverImp(std::move(serverImp)) {} void run(); int m_clientSocket; QString m_data; - TTcpIpServer *m_server; - TTcpIpServerImp *m_serverImp; + std::shared_ptr m_serverImp; }; //--------------------------------------------------------------------- @@ -374,7 +371,7 @@ void TTcpIpServer::run() } else { // creo un nuovo thread per la gestione dei dati ricevuti TThread::Executor executor; - executor.addTask(new DataReceiver(t, data, this, m_imp)); + executor.addTask(new DataReceiver(t, data, m_imp)); } } else { ::shutdown(t, 1); @@ -413,7 +410,7 @@ void TTcpIpServer::run() } TThread::Executor executor; - executor.addTask(new DataReader(t, this, m_imp)); + executor.addTask(new DataReader(t, m_imp)); } } else { m_exitCode = err; diff --git a/toonz/sources/toonzlib/autoclose.cpp b/toonz/sources/toonzlib/autoclose.cpp index 1443b63..a5289fb 100644 --- a/toonz/sources/toonzlib/autoclose.cpp +++ b/toonz/sources/toonzlib/autoclose.cpp @@ -1144,8 +1144,8 @@ return 0; /*=============================================================================*/ TAutocloser::TAutocloser(const TRasterP &r, int distance, double angle, int index, int opacity) + : m_imp(new Imp(r, distance, angle, index, opacity)) { - m_imp = new Imp(r, distance, angle, index, opacity); } //............................... @@ -1161,7 +1161,6 @@ void TAutocloser::exec() TAutocloser::~TAutocloser() { - delete m_imp; } //------------------------------------------------- diff --git a/toonz/sources/toonzlib/imagemanager.cpp b/toonz/sources/toonzlib/imagemanager.cpp index 8c31abb..a5bdbc4 100644 --- a/toonz/sources/toonzlib/imagemanager.cpp +++ b/toonz/sources/toonzlib/imagemanager.cpp @@ -181,7 +181,6 @@ ImageManager::ImageManager() ImageManager::~ImageManager() { - delete m_imp; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/scriptbinding_renderer.cpp b/toonz/sources/toonzlib/scriptbinding_renderer.cpp index d361a58..056d231 100644 --- a/toonz/sources/toonzlib/scriptbinding_renderer.cpp +++ b/toonz/sources/toonzlib/scriptbinding_renderer.cpp @@ -212,8 +212,6 @@ Renderer::Renderer() Renderer::~Renderer() { - delete m_imp; - m_imp = 0; } QScriptValue Renderer::ctor(QScriptContext *context, QScriptEngine *engine) diff --git a/toonz/sources/toonzlib/tlog.cpp b/toonz/sources/toonzlib/tlog.cpp index 044f4db..64204d1 100644 --- a/toonz/sources/toonzlib/tlog.cpp +++ b/toonz/sources/toonzlib/tlog.cpp @@ -210,7 +210,6 @@ TUserLogAppend::TUserLogAppend(const TFilePath &fp) : m_imp(new Imp(fp)) TUserLogAppend::~TUserLogAppend() { - //delete m_imp; } //------------------------------------------------------------------------------ diff --git a/toonz/sources/toonzlib/tstageobjecttree.cpp b/toonz/sources/toonzlib/tstageobjecttree.cpp index dc74a87..a67bb20 100644 --- a/toonz/sources/toonzlib/tstageobjecttree.cpp +++ b/toonz/sources/toonzlib/tstageobjecttree.cpp @@ -103,8 +103,6 @@ TStageObjectTree::TStageObjectTree() : m_imp(new TStageObjectTreeImp) TStageObjectTree::~TStageObjectTree() { - delete m_imp; - m_imp = 0; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/txsheet.cpp b/toonz/sources/toonzlib/txsheet.cpp index 966f795..afb8692 100644 --- a/toonz/sources/toonzlib/txsheet.cpp +++ b/toonz/sources/toonzlib/txsheet.cpp @@ -165,7 +165,10 @@ TXsheet::TXsheetImp::~TXsheetImp() // TXsheet TXsheet::TXsheet() - : TSmartObject(m_classCode), m_player(0), m_imp(new TXsheet::TXsheetImp), m_notes(new TXshNoteSet()) + : TSmartObject(m_classCode) + , m_player(0) + , m_imp(new TXsheet::TXsheetImp) + , m_notes(new TXshNoteSet()) { //extern TSyntax::Grammar *createXsheetGrammar(TXsheet*); m_soundProperties = new TXsheet::SoundProperties(); @@ -181,7 +184,6 @@ TXsheet::~TXsheet() texture_utils::invalidateTextures(this); assert(m_imp); - delete m_imp; if (m_notes) delete m_notes; if (m_soundProperties) diff --git a/toonz/sources/toonzqt/infoviewer.cpp b/toonz/sources/toonzqt/infoviewer.cpp index 62a4534..6eaf529 100644 --- a/toonz/sources/toonzqt/infoviewer.cpp +++ b/toonz/sources/toonzqt/infoviewer.cpp @@ -116,13 +116,13 @@ public slots: InfoViewer::InfoViewer(QWidget *parent) : Dialog() + , m_imp(new InfoViewerImp()) { setWindowTitle(tr("File Info")); setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); //setAttribute(Qt::WA_DeleteOnClose); m_parent = parent; - m_imp = new InfoViewerImp(); int i; for (i = 0; i < (int)m_imp->m_labels.size(); i++) { @@ -143,7 +143,6 @@ InfoViewer::InfoViewer(QWidget *parent) InfoViewer::~InfoViewer() { - delete m_imp; } //----------------------------------------------------------------