@@ -529,12 +529,14 @@ static gchar * frida_python_authentication_service_authenticate_finish (FridaAut
529529static void frida_python_authentication_service_do_authenticate (GTask * task , FridaPythonAuthenticationService * self );
530530
531531static int PyCompiler_init (PyCompiler * self , PyObject * args , PyObject * kw );
532+ static void PyCompiler_dealloc (PyCompiler * self );
532533static PyObject * PyCompiler_build (PyCompiler * self , PyObject * args , PyObject * kw );
533534static PyObject * PyCompiler_watch (PyCompiler * self , PyObject * args , PyObject * kw );
534535static gboolean PyCompiler_set_options (FridaCompilerOptions * options , const gchar * project_root_value , const gchar * output_format_value ,
535536 const gchar * bundle_format_value , const gchar * type_check_value , const gchar * source_maps_value , const gchar * compression_value );
536537
537538static int PyPackageManager_init (PyPackageManager * self , PyObject * args , PyObject * kw );
539+ static void PyPackageManager_dealloc (PyPackageManager * self );
538540static PyObject * PyPackageManager_repr (PyPackageManager * self );
539541static PyObject * PyPackageManager_search (PyPackageManager * self , PyObject * args , PyObject * kw );
540542static PyObject * PyPackageManager_install (PyPackageManager * self , PyObject * args , PyObject * kw );
@@ -559,6 +561,7 @@ static void PyPackageInstallResult_dealloc (PyPackageInstallResult * self);
559561static PyObject * PyPackageInstallResult_repr (PyPackageInstallResult * self );
560562
561563static int PyFileMonitor_init (PyFileMonitor * self , PyObject * args , PyObject * kw );
564+ static void PyFileMonitor_dealloc (PyFileMonitor * self );
562565static PyObject * PyFileMonitor_enable (PyFileMonitor * self );
563566static PyObject * PyFileMonitor_disable (PyFileMonitor * self );
564567
@@ -957,12 +960,14 @@ PYFRIDA_DEFINE_TYPE ("_frida.EndpointParameters", EndpointParameters, GObject, N
957960PYFRIDA_DEFINE_TYPE ("_frida.Compiler" , Compiler , GObject , NULL , frida_unref ,
958961 { Py_tp_doc , "Frida Compiler" },
959962 { Py_tp_init , PyCompiler_init },
963+ { Py_tp_dealloc , PyCompiler_dealloc },
960964 { Py_tp_methods , PyCompiler_methods },
961965);
962966
963967PYFRIDA_DEFINE_TYPE ("_frida.PackageManager" , PackageManager , GObject , NULL , frida_unref ,
964968 { Py_tp_doc , "Frida Package Manager" },
965969 { Py_tp_init , PyPackageManager_init },
970+ { Py_tp_dealloc , PyPackageManager_dealloc },
966971 { Py_tp_repr , PyPackageManager_repr },
967972 { Py_tp_methods , PyPackageManager_methods },
968973);
@@ -994,6 +999,7 @@ PYFRIDA_DEFINE_TYPE ("_frida.PackageInstallResult", PackageInstallResult, GObjec
994999PYFRIDA_DEFINE_TYPE ("_frida.FileMonitor" , FileMonitor , GObject , NULL , frida_unref ,
9951000 { Py_tp_doc , "Frida File Monitor" },
9961001 { Py_tp_init , PyFileMonitor_init },
1002+ { Py_tp_dealloc , PyFileMonitor_dealloc },
9971003 { Py_tp_methods , PyFileMonitor_methods },
9981004);
9991005
@@ -4869,11 +4875,21 @@ PyCompiler_init (PyCompiler * self, PyObject * args, PyObject * kw)
48694875 if (PyGObject_tp_init ((PyObject * ) self , args , kw ) < 0 )
48704876 return -1 ;
48714877
4878+ g_atomic_int_inc (& toplevel_objects_alive );
4879+
48724880 PyGObject_take_handle (& self -> parent , frida_compiler_new (NULL ), PYFRIDA_TYPE (Compiler ));
48734881
48744882 return 0 ;
48754883}
48764884
4885+ static void
4886+ PyCompiler_dealloc (PyCompiler * self )
4887+ {
4888+ g_atomic_int_dec_and_test (& toplevel_objects_alive );
4889+
4890+ PyGObject_tp_dealloc ((PyObject * ) self );
4891+ }
4892+
48774893static PyObject *
48784894PyCompiler_build (PyCompiler * self , PyObject * args , PyObject * kw )
48794895{
@@ -5030,11 +5046,21 @@ PyPackageManager_init (PyPackageManager * self, PyObject * args, PyObject * kw)
50305046 if (PyGObject_tp_init ((PyObject * ) self , args , kw ) < 0 )
50315047 return -1 ;
50325048
5049+ g_atomic_int_inc (& toplevel_objects_alive );
5050+
50335051 PyGObject_take_handle (& self -> parent , frida_package_manager_new (), PYFRIDA_TYPE (PackageManager ));
50345052
50355053 return 0 ;
50365054}
50375055
5056+ static void
5057+ PyPackageManager_dealloc (PyPackageManager * self )
5058+ {
5059+ g_atomic_int_dec_and_test (& toplevel_objects_alive );
5060+
5061+ PyGObject_tp_dealloc ((PyObject * ) self );
5062+ }
5063+
50385064static PyObject *
50395065PyPackageManager_repr (PyPackageManager * self )
50405066{
@@ -5373,11 +5399,21 @@ PyFileMonitor_init (PyFileMonitor * self, PyObject * args, PyObject * kw)
53735399 if (!PyArg_ParseTuple (args , "s" , & path ))
53745400 return -1 ;
53755401
5402+ g_atomic_int_inc (& toplevel_objects_alive );
5403+
53765404 PyGObject_take_handle (& self -> parent , frida_file_monitor_new (path ), PYFRIDA_TYPE (FileMonitor ));
53775405
53785406 return 0 ;
53795407}
53805408
5409+ static void
5410+ PyFileMonitor_dealloc (PyFileMonitor * self )
5411+ {
5412+ g_atomic_int_dec_and_test (& toplevel_objects_alive );
5413+
5414+ PyGObject_tp_dealloc ((PyObject * ) self );
5415+ }
5416+
53815417static PyObject *
53825418PyFileMonitor_enable (PyFileMonitor * self )
53835419{
0 commit comments