Ejemplo n.º 1
0
 def shutdown(self, wait=True):
     """ stop threads and close and remove underlying dc_context and callbacks. """
     if hasattr(self, "_dc_context") and hasattr(self, "_threads"):
         self.stop_threads(wait=False)  # to interrupt idle and tell python threads to stop
         lib.dc_close(self._dc_context)
         self.stop_threads(wait=wait)  # to wait for threads
         deltachat.clear_context_callback(self._dc_context)
         del self._dc_context
Ejemplo n.º 2
0
def _destroy_dc_context(dc_context, dc_context_unref=lib.dc_context_unref):
    # destructor for dc_context
    dc_context_unref(dc_context)
    try:
        deltachat.clear_context_callback(dc_context)
    except (TypeError, AttributeError):
        # we are deep into Python Interpreter shutdown,
        # so no need to clear the callback context mapping.
        pass
Ejemplo n.º 3
0
 def shutdown(self, wait=True):
     """ stop threads and close and remove underlying dc_context and callbacks. """
     if hasattr(self, "_dc_context") and hasattr(self, "_threads"):
         # print("SHUTDOWN", self)
         self.stop_threads(wait=False)
         lib.dc_close(self._dc_context)
         self.stop_threads(wait=wait)  # to wait for threads
         deltachat.clear_context_callback(self._dc_context)
         del self._dc_context
Ejemplo n.º 4
0
def _destroy_dc_context(dc_context, dc_context_unref=lib.dc_context_unref):
    # destructor for dc_context
    dc_context_unref(dc_context)
    try:
        deltachat.clear_context_callback(dc_context)
    except (TypeError, AttributeError):
        # we are deep into Python Interpreter shutdown,
        # so no need to clear the callback context mapping.
        pass
Ejemplo n.º 5
0
def test_callback_None2int():
    ctx = capi.lib.dc_context_new(capi.lib.py_dc_callback, ffi.NULL, ffi.NULL)
    set_context_callback(ctx, lambda *args: None)
    capi.lib.dc_close(ctx)
    clear_context_callback(ctx)
Ejemplo n.º 6
0
def dc_account_after_shutdown(dc_context):
    deltachat.clear_context_callback(dc_context)