[Gambas-devel] [Gambas-devel-svn] SF.net SVN: gambas:[6035] gambas/trunk

Tobias Boege tobias at ...692...
Mon Dec 30 02:49:20 CET 2013


On Mon, 30 Dec 2013, tobiasboe at ...1... wrote:
> Revision: 6035
>           http://sourceforge.net/p/gambas/code/6035
> Author:   tobiasboe
> Date:     2013-12-30 01:37:38 +0000 (Mon, 30 Dec 2013)
> Log Message:
> -----------
> [GB.INOTIFY]
> * NEW: New component to interface Gambas with the Linux-specific inotifies
> * NEW: The Inotify class can be created to watch a certain path for events
>   which are reported by various Gambas events being raised.
> 

Benoit, the Inotify class gets a bonus reference because it is watched by
the interpreter. IIRC, I have seen this in another component and begin now
to wonder if this is necessary.

Assumed, it wouldn't have that bonus reference and the user dropped the last
"regular" reference (i.e. from a variable) and the _free() method would
de-register the watch, wouldn't all be fine? Then the Inotify class would
behave more naturally among other Gambas classes (which normally don't have
hidden bonus references).

Sample project attached. It works well because I use a console program and
QUIT all the stuff away anyway.

But my worries arose when I thought about using inotifies in a GUI
application. I would have (to not use QUIT) to manually remove all the
watches so that the interpreter terminates. This means I would have to save
all the Inotify objects in an array and Release() every object, then clear
the array. Doesn't sound like it should be...

So: is this bonus reference for watched objects necessary or just an awry
memory in my head?

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-inotify-0.0.1.tar.gz
Type: application/octet-stream
Size: 5727 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20131230/8afbd763/attachment.obj>


More information about the Devel mailing list