awesome/common
Uli Schlachter 489aa4dc24 Improve behaviour of GC'd objects
Before this commit: When we are GC'ing an object, we clear its metatable, since
otherwise crashes could occur in various places. This means that if someone
tries to use such an object, they get an unhelpful error message like "attempt
to index userdata object" and they don't understand what the problem is. Also,
this means that foo.valid does not actually work after GC.

This commit changes this behaviour. Instead of setting an empty metatable, we
now create a metatable with an __index and __newindex method. These metamethods
produce better error messages that they sat the underlying object was already
garbage collected. Better yet, the __index metamethod makes foo.valid be false
instead of causing an error, so that the existing machinery for detecting
invalid objects continues to work.

This commit also adds a functional test that verifies this behaviour.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-24 14:37:07 +02:00
..
array.h Deprecate signal_add() on C-API objects 2016-06-04 17:51:45 +02:00
atoms.c remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
atoms.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
atoms.list Keep client order across restarts 2015-07-27 13:47:09 +02:00
backtrace.c remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
backtrace.h remove encoding=utf-8 from modelines 2011-09-11 17:34:09 +02:00
buffer.c Add a vim modeline to all C source 2015-12-12 17:42:16 +01:00
buffer.h Add a vim modeline to all C source 2015-12-12 17:42:16 +01:00
luaclass.c Improve behaviour of GC'd objects 2016-09-24 14:37:07 +02:00
luaclass.h Deprecate signal_add() on C-API objects 2016-06-04 17:51:45 +02:00
lualib.c Add a vim modeline to all C source 2015-12-12 17:42:16 +01:00
lualib.h minor: fix/improve doc comments 2015-07-12 17:42:53 +02:00
luaobject.c Fix disconnecting not connected signals (#950) 2016-06-09 00:03:08 +02:00
luaobject.h Deprecate signal_add() on C-API objects 2016-06-04 17:51:45 +02:00
signal.h Test & fix a bug with dbus.disconnect_signal (#1096) 2016-09-18 12:50:40 +02:00
util.c Add timestamps to messages on stderr (#602) 2015-12-31 15:38:17 +01:00
util.h Add timestamps to messages on stderr (#602) 2015-12-31 15:38:17 +01:00
version.c Print LuaJIT version in --version (#996) 2016-07-09 19:05:44 +02:00
version.h Add a vim modeline to all C source 2015-12-12 17:42:16 +01:00
xcursor.c Switch from libXcursor to libxcb-cursor 2013-09-19 16:48:10 +02:00
xcursor.h Switch from libXcursor to libxcb-cursor 2013-09-19 16:48:10 +02:00
xembed.c Properly support the XEMBED_MAPPED bit 2016-05-31 08:55:42 +02:00
xembed.h Clean up header includes 2014-03-30 20:07:48 +02:00
xutil.c Remove some unused fields from globalconf 2015-12-22 17:25:45 +01:00
xutil.h xutil.h: Add defines for valid coordinates and sizes 2016-04-17 13:48:24 +02:00