Skip to content

[BUG] Error when using poll variable inside literal #1323

Open
@edwin0cheng

Description

@edwin0cheng

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

When using literal , and inside that literal is referencing another variable, an error "Couldn't upgrade reference, widget got deallocated" occurred.

The related code :
https://github.com/elkowar/eww/blob/98c220126d912b935987766f56650b55f3e226eb/crates/eww/src/widgets/def_widget_macro.rs#L52C50-L52C102

I am not familiar with the code base, but my guess is that the listener is not unregistered after old widget is deleted by the new poll variable triggered ?

Reproducing the issue

eww.yack

 (deflisten vf "script.sh")  
 (defvar vf "script.sh")  

 (defwidget widget [] (literal :content vf))
 (defwindow window (widget))

script.sh

#!/bin/bash

widget()
{
	w='(box (button :onclick "eww update vv=true --config='.' " "show")(button :onclick "eww update vv=false --config='.'" "hide")(revealer :reveal vv (label :text "Yeah")))'
	echo "$w"
}

widget
eww --config . --logs open window

And when you click on the hide button, the error is showed in the logs:

Caused by:
    Couldn't upgrade reference, widget got deallocated
 2025-05-19T01:07:08.283Z ERROR eww::error_handling_ctx > Error while updating UI after state change

Expected behaviour

No response

Additional context

No response

Platform and environment

wayland, hypland

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions