python: avoid careless calls to unref functions

This commit is contained in:
adbenitez
2022-06-10 23:13:29 -04:00
parent e280ca9db8
commit f5ef650b4d
7 changed files with 36 additions and 20 deletions

View File

@@ -11,7 +11,7 @@ from queue import Empty, Queue
import deltachat
from .capi import ffi, lib
from .cutil import from_optional_dc_charpointer
from .cutil import from_optional_dc_charpointer, safe_unref
from .hookspec import account_hookimpl
from .message import map_system_message
@@ -229,7 +229,7 @@ class EventThread(threading.Thread):
def _inner_run(self):
event_emitter = ffi.gc(
lib.dc_get_event_emitter(self.account._dc_context),
lib.dc_event_emitter_unref,
safe_unref(lib.dc_event_emitter_unref),
)
while not self._marked_for_shutdown:
event = lib.dc_get_next_event(event_emitter)