X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fcontent_part.h;h=590be311289406c738b153423d5a6ab206a8d9e2;hp=4f6e9e396bbb70325505cfd7f7cce191ead95e3b;hb=da44da6f31f97d39ca91c35955e573e76371f2c2;hpb=c6871fe8617b3de03662b7630355059393bf8043 diff --git a/src/lib/content_part.h b/src/lib/content_part.h index 4f6e9e396..590be3112 100644 --- a/src/lib/content_part.h +++ b/src/lib/content_part.h @@ -1,6 +1,5 @@ - /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -19,16 +18,20 @@ */ + #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: @@ -41,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