Frees the native resources held by this MjrContext. This is an advanced feature for use when manual memory management is necessary. This MjrContext object MUST NOT be used after this function has been called.
(self)
| 616 | return self._ptr() |
| 617 | |
| 618 | def free(self): |
| 619 | """Frees the native resources held by this MjrContext. |
| 620 | |
| 621 | This is an advanced feature for use when manual memory management is |
| 622 | necessary. This MjrContext object MUST NOT be used after this function has |
| 623 | been called. |
| 624 | """ |
| 625 | if self._gl_context and not self._gl_context.terminated: |
| 626 | ptr = self.ptr |
| 627 | if ptr: |
| 628 | self._gl_context.dont_keep_alive(ptr) |
| 629 | with self._gl_context.make_current() as ctx: |
| 630 | ctx.call(ptr.free) |
| 631 | |
| 632 | if self._gl_context: |
| 633 | self._gl_context.decrement_refcount() |
| 634 | self._gl_context.free() |
| 635 | self._gl_context = None |
| 636 | |
| 637 | def __del__(self): |
| 638 | self.free() |
no test coverage detected