Skip to content

Commit

Permalink
add __del__ to lib
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Sep 17, 2024
1 parent 29ba3d9 commit 96a54b0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pygeodiff/geodifflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ def __init__(self, name):
self.check_version()
self._register_functions()

def __del__(self):
self.shutdown()

def shutdown(self):
if platform.system() == "Windows":
from _ctypes import FreeLibrary
if self.lib is not None:
if platform.system() == "Windows":
from _ctypes import FreeLibrary

FreeLibrary(self.lib._handle)
self.lib = None
FreeLibrary(self.lib._handle)
self.lib = None

def _register_functions(self):
self._readChangeset = self.lib.GEODIFF_readChangeset
Expand Down

0 comments on commit 96a54b0

Please sign in to comment.