Coder Social home page Coder Social logo

Comments (2)

dfuehrer avatar dfuehrer commented on August 21, 2024 4

When you send a signal to dwmblocks by clicking or scrolling on the status bar, it has to handle the interrupt before it can finish what it was doing. If you were updating one of your blocks when this happened, then the fgets function will exit with the EINTR error and return NULL as if it could not read anything, causing the block to disappear. Because of this, this issue is more likely to occur if your blocks take longer to update.
There is a related issue where the sleep function is also broken out of during the interrupt. This causes the "time" variable to be incremented prematurely, updating the next block right away as well as updating blocks with larger longer update intervals much sooner in these scrolling scenarios. This also makes this bug more likely to happen.
The first issue is solved by writing the output of fgets to a temp buffer and copying it over on success, and optionally trying to read again until the EINTR error goes away. The second issue is solved by using nanosleep and continuing the sleep with whatever was left when it exited before moving on to update.
Both of these issues are solved (I cannot recreate this bug anymore) here https://github.com/dfuehrer/dwmblocks/tree/mychanges.

from dwmblocks.

katrushenkov avatar katrushenkov commented on August 21, 2024 2

void getcmd(const Block *block, char *output)
{
...
fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
...
pclose(cmdf);
}

here at line 78 of dwmblocks.c , when inputting too quickly .( for example a quick scroll).
there will be a flush of function getcmd executed at once.

and somehow this causes the fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);

not printing anything to (output +i) ; so the block content got disappeared.
I have verified to let buttonhandler to handle another script but same signal. and commented out the buttonhandler's signal or status updating functions, the problem remains.

Lets fix this problem , any ideas ?

I have similar issue. Is that what you are talking about?
https://imgur.com/a/EKPOFug

from dwmblocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.