File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,6 +139,39 @@ class AutoSetRestore
139139 T oldValue;
140140};
141141
142+
143+ template <typename T>
144+ class AutoSetRestoreFlag
145+ {
146+ public:
147+ AutoSetRestoreFlag (T* aValue, T newBit, bool set)
148+ : value(aValue),
149+ bit (newBit),
150+ oldValue((*value) & bit)
151+ {
152+ if (set)
153+ *value |= bit;
154+ else
155+ *value &= ~bit;
156+ }
157+
158+ ~AutoSetRestoreFlag ()
159+ {
160+ *value &= ~bit;
161+ *value |= oldValue;
162+ }
163+
164+ private:
165+ // copying is prohibited
166+ AutoSetRestoreFlag (const AutoSetRestoreFlag&);
167+ AutoSetRestoreFlag& operator =(const AutoSetRestoreFlag&);
168+
169+ T* value;
170+ T bit;
171+ T oldValue;
172+ };
173+
174+
142175template <typename T, typename T2>
143176class AutoSetRestore2
144177{
Original file line number Diff line number Diff line change @@ -774,6 +774,9 @@ void IDX_garbage_collect(thread_db* tdbb,
774774 insertion.iib_relation = rpb->rpb_relation ;
775775 insertion.iib_key = &key1;
776776
777+ Attachment* att = tdbb->getAttachment ();
778+ AutoSetRestoreFlag<ULONG> gc (&att->att_flags , ATT_no_cleanup, true );
779+
777780 WIN window (get_root_page (tdbb, rpb->rpb_relation ));
778781
779782 index_root_page* root = (index_root_page*) CCH_FETCH (tdbb, &window, LCK_read, pag_root);
You can’t perform that action at this time.
0 commit comments