Commit Graph

18 Commits

Author SHA1 Message Date
Uli Schlachter 8fdc89ff09 Add and use gears.timer.run_delayed_calls_now()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-15 17:04:19 +01:00
Emmanuel Lepage Vallee b59495e1e7 tag/tasklist: Update rc.lua
And the tests to avoid some deprecation warnings
2017-12-02 16:33:06 -05:00
Uli Schlachter da6012da3e Fix memory leak in the default config on screen removal
The default config had tables like mywibox and mywibox[s] was the wibox
that is visible on screen s. When a screen is removed, nothing cleans up
these tables and so the screen and the wibox could not be garbage
collected. The same applies to the layoutbox, taglist etc.

This commit removes the global mywibox table and instead saves it as a
property on the screen. This way, the screen is not explicitly
referenced and when it is removed, the screen, its wibox and all of its
widgets become unreachable and can be garbage collected.

This commit also updates the docs and the tests that referenced things
(mostly the wibox) via mywibox[s] to now use s.mywibox.

Fixes: https://github.com/awesomeWM/awesome/issues/1125
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 22:46:51 +02:00
Emmanuel Lepage Vallee ae0d306114 textclock: Move to wibox.widget
It doesn't depend on `awful`, so it doesn't belong in `awful`.
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee bb5ee50de9 layoutbox: Revert 25f4f24791
Apparently, there is such thing as not leaking enough...

Also try to clear the widgets from mywibox. This seem to help.

Time will tell.

Fixes #914, unfixes #808
2016-05-18 01:45:21 -04:00
Emmanuel Lepage Vallée e8c7e573cb Merge pull request #778 from Elv13/dummy2
Call collectgarbage() more often

This may or may not fix a random test failure on Travis with LuaJIT (5.1).
2016-03-27 17:05:02 -04:00
Uli Schlachter 5ccdb933bf C-API: Return screen objects instead of indicies
This commit makes all C code that previously returned a screen index now return
a screen object, continuing the deprecation of screen indicies. Note that this
is an API break and will likely cause all kinds of problems for users.

The change also breaks some tests which are suitably fixed in this commit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-26 18:09:24 +01:00
Emmanuel Lepage Vallee 182f21b48a tests: Call collectgarbage 3 time
Try to avoid a race condition when testing awful.layout
2016-03-26 05:14:59 -04:00
Uli Schlachter e18bece3df Make tests more reliable on "early errors"
When e.g. test-leaks.lua fails, it will cause a Lua error before starting the
test runner. This means that the test will just hang, because nothing causes
awesome to quit.

Handle this by starting a timer when the test runner is loaded and quitting
awesome in there if no test run was started yet. This only works if all tests
load the runner before doing anything that could fail, so the require("_runner")
is moved to the beginning in every test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-06 10:20:45 +01:00
Uli Schlachter bf3b9b5f42 tests: Fix luacheck warnings
This leaves one warning in tests/test-urgent.lua which points out an actual
bug/problem.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:12:41 +01:00
Uli Schlachter 63653bed76 Add the right vim modeline to all lua files
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:42:33 +01:00
Uli Schlachter 3e9fdea650 test-leaks: Fix with Lua 5.1
I have no idea why this needs collectgarbage() to be called twice.

On the other hand, I can explain the change in tooltip.lua. Lua 5.2 introduced
"ephermeron tables". This means that in the following sitation, lua 5.2 can
collect the entry from the table, while 5.1 keeps the entry alive, because the
table has a strong reference to the value and that in turn has a strong
reference to the key:

  t = setmetatable({}, { __mode = "k"})
  do
    local k = {}
    t[k] = function() print(k) end
  end
  collectgarbage("collect")
  print(next(t, nil))

To handle this incompatibility, this commit just removes the whole indirection
through the module-level variable "data".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 16:04:20 +02:00
Uli Schlachter 94271e8c91 test-leaks.lua: Also test tooltips
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:31:42 +02:00
Uli Schlachter f7799cbb7f Refactior test-leaks a bit
I think it looks nicer with this helper function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 15:30:04 +02:00
Uli Schlachter bd47edb4ef leak test: Make the layoutbox test pass
This commit does two things: It gets rid of the reference to the layoutbox that
the default config created and it changes the widget dependency cache to not
keep widgets alive unnecessarily.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:42:39 +02:00
Uli Schlachter abc5a552a4 Make tasklist garbage-collectable
Again, instead of directly connecting to various signals for updating a
tasklist, this commit changes the code so that there is just a single, global
connections and based on this a weak table with all tasklist instances is used
do the updates.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:20:24 +02:00
Uli Schlachter 40db0b7337 Make taglists garbage-collectable
Similar to what the previous commit does for layoutboxes, this changes the code
for the taglist so that there is only a single, global connection to the various
signals and these update all taglists via weak tables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:03:59 +02:00
Uli Schlachter 901c8f680a tests: Add some memory-leak tests
This creates some random collection of widgets and tests if they can be garbage
collected again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 12:36:21 +02:00