[WIP/RFC] Improve warning with already destroyed notification
This commit is contained in:
parent
3340a7dce9
commit
c41cf95eec
|
@ -438,14 +438,18 @@ local notification = {}
|
||||||
--- Destroy notification by notification object.
|
--- Destroy notification by notification object.
|
||||||
--
|
--
|
||||||
-- @method destroy
|
-- @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
|
-- @tparam[opt=false] boolean keep_visible If true, keep the notification visible
|
||||||
-- @return True if the popup was successfully destroyed, false otherwise
|
-- @return True if the popup was successfully destroyed, false otherwise
|
||||||
function notification:destroy(reason, keep_visible)
|
function notification:destroy(reason, keep_visible)
|
||||||
if self._private.is_destroyed then
|
if self._private.is_destroyed then
|
||||||
gdebug.print_warning("Trying to destroy the same notification twice. It"..
|
gdebug.print_warning(string.format(
|
||||||
" was destroyed because: "..self._private.destroy_reason)
|
"Trying to destroy an already destroyed notification. "..
|
||||||
return false
|
"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
|
end
|
||||||
|
|
||||||
reason = reason or cst.notification_closed_reason.dismissed_by_user
|
reason = reason or cst.notification_closed_reason.dismissed_by_user
|
||||||
|
|
Loading…
Reference in New Issue