[Gambas-bugtracker] Bug #1404: Object model : Special method "_free" not available anymore / Circular reference dependency

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sat Aug 25 09:48:34 CEST 2018


http://gambaswiki.org/bugtracker/edit?object=BUG.1404&from=L21haW4-

Mourad REGGADI reported a new bug.

Summary
-------

Object model : Special method "_free" not available anymore / Circular reference dependency

Type             : Bug
Priority         : Medium
Gambas version   : Unknown
Product          : Language


Description
-----------

I use some classes with implementation of "_free" special method (so i can deallocate some dynamically allocated properties). I just noticed while debugging that it is never called, more than that editor's autocompletion does not show it as a suggestion while it is showing other special methods (_init, _call) etc ...

I have hard time designing classes without suffering from circular reference dependencies and all available solutions suggested on internet for some other object oriented programming languages seem to be not applicable for Gambas (using interfaces etc..). The problem is i have a class A which has a class B as a property. class B needs a reference to class A so it can access some of its properties (i am using "_init" to keep a reference to class A). When trying to free A, B keeps a reference to it .... The other way doesn't work either (destroy B before A ...). At this point i am stuck and i can't find a way to implement such class interaction with Gambas without provoking memory leaks. Is there a mechanism in Gambas object model that can do the trick ? Thanks a lot.


System information
------------------

[System]
Gambas=3.11.90
OperatingSystem=Linux
Kernel=3.19.0-32-generic
Architecture=x86_64
Distribution=Linux Mint 17.3 Rosa
Desktop=MATE
Theme=Gtk
Language=fr_FR.UTF-8
Memory=3774M

[Libraries]
Cairo=libcairo.so.2.11301.0
Curl=libcurl.so.4.3.0
DBus=libdbus-1.so.3.7.6
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.204.0
GTK+2=libgtk-x11-2.0.so.0.2400.23
GTK+3=libgtk-3.so.0.1000.8
OpenGL=libGL.so.1.2.0
Poppler=libpoppler.so.44.0.0
QT4=libQtCore.so.4.8.6
QT5=libQt5Core.so.5.2.1
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
CLUTTER_IM_MODULE=xim
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-ay8dtpCz8R,guid=a6a109373b163b4f85b4ca975b19226b
DBUS_STARTER_ADDRESS=unix:abstract=/tmp/dbus-ay8dtpCz8R,guid=a6a109373b163b4f85b4ca975b19226b
DBUS_STARTER_BUS_TYPE=session
DEFAULTS_PATH=/usr/share/gconf/mate.default.path
DESKTOP_SESSION=mate
DISPLAY=:0
GB_GUI=gb.qt4
GDMSESSION=mate
GDM_XSERVER_LOCATION=local
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-ilUXlo
GNOME_KEYRING_PID=1979
GPG_AGENT_INFO=/run/user/1000/keyring-ilUXlo/gpg:0:1
GTK_IM_MODULE=xim
GTK_OVERLAY_SCROLLING=0
HOME=<home>
IM_CONFIG_PHASE=1
LANG=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_MONETARY=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_NUMERIC=fr_FR.UTF-8
LC_PAPER=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LOGNAME=<user>
MANDATORY_PATH=/usr/share/gconf/mate.mandatory.path
MATE_DESKTOP_SESSION_ID=this-is-deprecated
MDMSESSION=mate
MDM_LANG=fr_FR.UTF-8
MDM_XSERVER_LOCATION=local
PAPERSIZE=a4
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=<home>
QT4_IM_MODULE=xim
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/2055,unix/<hostname>:/tmp/.ICE-unix/2055
SHELL=/bin/bash
SSH_AGENT_PID=2123
SSH_AUTH_SOCK=/run/user/1000/keyring-ilUXlo/ssh
TEXTDOMAIN=im-config
TEXTDOMAINDIR=/usr/share/locale/
TZ=:/etc/localtime
USER=<user>
USERNAME=<user>
WINDOWPATH=8
XAUTHORITY=<home>/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-mate:/etc/xdg
XDG_CURRENT_DESKTOP=MATE
XDG_DATA_DIRS=/usr/share/mate:/usr/local/share/:/usr/share/:/usr/share/mdm/
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_COOKIE=00374c2810afb31e356ebd07562d38e8-1528373867.339000-2065504855
XDG_SESSION_DESKTOP=mate
XDG_SESSION_ID=c1
XDG_VTNR=8
XMODIFIERS=@im=none




More information about the Bugtracker mailing list