Commit 7a24b32
committed
Change picking manager to not own objects associated with pickers
When adding a vtkPicker to the picking manager, a vtkObject can optionally be
associated with the picker. This commit changes the behavior of
vtkPickingManager to not own (i.e. increment the reference count) of these
associated objects. Instead, the object references are held in a raw pointer.
The widget framework is the primary client of the picking manager. The typical
vtkWidgetRepresentation subclass adds its pickers to the picking manager and
includes an associated object reference to itself:
pickingManager->AddPicker(picker, this);
When the widget/representation are destroyed, the vtkWidgetRepresentation
destructor unregisters its pickers:
pickingManager->RemoveObject(this);
However, because the picking manager took ownership of the associated objects,
the vtkWidgetRepresentation instances and their pickers are not destroyed until
the vtkPickingManager is destroyed. In particular applications, this could lead
to a large number of objects referenced only by vtkPickingManager that would
exist until application exit.
The picking manager test is updated for the use case demonstrated by the widget
framework.1 parent 9fe2433 commit 7a24b32
File tree
2 files changed
+105
-31
lines changed- Rendering/Core
- Testing/Cxx
2 files changed
+105
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
90 | 158 | | |
91 | 159 | | |
92 | 160 | | |
| |||
98 | 166 | | |
99 | 167 | | |
100 | 168 | | |
| 169 | + | |
101 | 170 | | |
102 | 171 | | |
103 | 172 | | |
| |||
253 | 322 | | |
254 | 323 | | |
255 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
256 | 347 | | |
257 | 348 | | |
258 | 349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | 141 | | |
159 | 142 | | |
160 | 143 | | |
| |||
202 | 185 | | |
203 | 186 | | |
204 | 187 | | |
205 | | - | |
206 | | - | |
207 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
208 | 191 | | |
209 | 192 | | |
210 | 193 | | |
| |||
234 | 217 | | |
235 | 218 | | |
236 | 219 | | |
237 | | - | |
238 | | - | |
239 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
240 | 223 | | |
241 | 224 | | |
242 | 225 | | |
| |||
418 | 401 | | |
419 | 402 | | |
420 | 403 | | |
421 | | - | |
422 | | - | |
423 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
424 | 407 | | |
425 | 408 | | |
426 | 409 | | |
| |||
446 | 429 | | |
447 | 430 | | |
448 | 431 | | |
449 | | - | |
450 | | - | |
451 | | - | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
452 | 435 | | |
453 | 436 | | |
454 | 437 | | |
| |||
0 commit comments