X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fcontent_part.h;h=eb96b13710e210593ca47c8911225362d5bfb084;hp=d3b9b310d97747a31af4fe3ebfafb02a03df50a3;hb=HEAD;hpb=3828baf56467224f5d44049bf1e7a7ed11f43a05 diff --git a/src/lib/content_part.h b/src/lib/content_part.h index d3b9b310d..590be3112 100644 --- a/src/lib/content_part.h +++ b/src/lib/content_part.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,20 +18,24 @@ */ + #ifndef DCPOMATIC_CONTENT_PART_H #define DCPOMATIC_CONTENT_PART_H + +#include "change_signaller.h" #include "content.h" -#include #include + class Content; class Film; + class ContentPart { public: - ContentPart (Content* parent) + explicit ContentPart (Content* parent) : _parent (parent) {} @@ -40,32 +44,35 @@ protected: void maybe_set (T& member, T new_value, int property) const { + ContentChangeSignaller cc (_parent, property); { boost::mutex::scoped_lock lm (_mutex); if (member == new_value) { + cc.abort (); return; } member = new_value; } - _parent->signal_changed (property); } template void maybe_set (boost::optional& member, T new_value, int property) const { + ContentChangeSignaller cc (_parent, property); { boost::mutex::scoped_lock lm (_mutex); if (member && member.get() == new_value) { + cc.abort (); return; } member = new_value; } - _parent->signal_changed (property); } Content* _parent; mutable boost::mutex _mutex; }; + #endif