[WIP/RFC] Improve warning with already destroyed notification

This commit is contained in:
Daniel Hahler 2019-10-11 14:43:17 +02:00
parent 3340a7dce9
commit c41cf95eec

View file

@ -438,13 +438,17 @@ local notification = {}
--- Destroy notification by notification object.
--
-- @method destroy
-- @tparam string reason One of the reasons from `notification_closed_reason`
-- @tparam number reason One of the reasons from
-- `naughty.constants.notification_closed_reason`.
-- @tparam[opt=false] boolean keep_visible If true, keep the notification visible
-- @return True if the popup was successfully destroyed, false otherwise
function notification:destroy(reason, keep_visible)
if self._private.is_destroyed then
gdebug.print_warning("Trying to destroy the same notification twice. It"..
" was destroyed because: "..self._private.destroy_reason)
gdebug.print_warning(string.format(
"Trying to destroy an already destroyed notification. "..
"original reason=%s, reason=%s, title=%s, text=%s\n%s",
self._private.destroy_reason, reason, self.title, self.text,
_G.debug.traceback()))
return false
end