From: Matthew Fernandez Date: Sat, 12 Jun 2021 20:14:01 +0000 (-0700) Subject: mark Block as an uncopyable object X-Git-Tag: 2.48.0~44^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d7d0e051e82d07c52bdcdda5e626eac324b6a86;p=graphviz mark Block as an uncopyable object Objects of type Block were already unsafe to copy (or move). The class contains raw pointers that are deleted in the destructor. So any attempt to copy an object of this type would have eventually caused a use-after-free and/or a double free. This change makes the situation more explicit by teaching the compiler it is unsafe to copy or move objects of this type. If there is code that implicitly does this, it will now be rejected at compile time. --- diff --git a/lib/vpsc/block.h b/lib/vpsc/block.h index be6329f12..9055c14e5 100644 --- a/lib/vpsc/block.h +++ b/lib/vpsc/block.h @@ -34,6 +34,7 @@ public: double weight; double wposn; Block(Variable *v=nullptr); + Block(const Block &) = delete; ~Block(); Constraint* findMinLM(); Constraint* findMinLMBetween(Variable* lv, Variable* rv);