| 81 | } |
| 82 | |
| 83 | void b2Fixture::Destroy(b2BlockAllocator* allocator) |
| 84 | { |
| 85 | // The proxies must be destroyed before calling this. |
| 86 | b2Assert(m_proxyCount == 0); |
| 87 | |
| 88 | // Free the proxy array. |
| 89 | int32 childCount = m_shape->GetChildCount(); |
| 90 | allocator->Free(m_proxies, childCount * sizeof(b2FixtureProxy)); |
| 91 | m_proxies = NULL; |
| 92 | if (m_shape->m_filterPerChild) |
| 93 | { |
| 94 | allocator->Free(m_filters, childCount * sizeof(b2Filter)); |
| 95 | } |
| 96 | |
| 97 | // Defold mod: Don't take ownership of shape |
| 98 | // // Free the child shape. |
| 99 | // switch (m_shape->m_type) |
| 100 | // { |
| 101 | // case b2Shape::e_circle: |
| 102 | // { |
| 103 | // b2CircleShape* s = (b2CircleShape*)m_shape; |
| 104 | // s->~b2CircleShape(); |
| 105 | // allocator->Free(s, sizeof(b2CircleShape)); |
| 106 | // } |
| 107 | // break; |
| 108 | // |
| 109 | // case b2Shape::e_edge: |
| 110 | // { |
| 111 | // b2EdgeShape* s = (b2EdgeShape*)m_shape; |
| 112 | // s->~b2EdgeShape(); |
| 113 | // allocator->Free(s, sizeof(b2EdgeShape)); |
| 114 | // } |
| 115 | // break; |
| 116 | // |
| 117 | // case b2Shape::e_polygon: |
| 118 | // { |
| 119 | // b2PolygonShape* s = (b2PolygonShape*)m_shape; |
| 120 | // s->~b2PolygonShape(); |
| 121 | // allocator->Free(s, sizeof(b2PolygonShape)); |
| 122 | // } |
| 123 | // break; |
| 124 | // |
| 125 | // case b2Shape::e_chain: |
| 126 | // { |
| 127 | // b2ChainShape* s = (b2ChainShape*)m_shape; |
| 128 | // s->~b2ChainShape(); |
| 129 | // allocator->Free(s, sizeof(b2ChainShape)); |
| 130 | // } |
| 131 | // break; |
| 132 | // |
| 133 | // default: |
| 134 | // b2Assert(false); |
| 135 | // break; |
| 136 | // } |
| 137 | |
| 138 | m_shape = NULL; |
| 139 | } |
| 140 |
no test coverage detected