[Pkg-xfce-devel] Bug#631114: Bug#631114: mousepad: freezes for a while on"enter" key press
12 ??????? 2011, 19:14 ?? Yves-Alexis Perez <corsac at debian.org>:
> How exactly did you cook this?
I don't understand exactly what that means, so I try to answer to my
understanding of your question: "how exactly did you find this?".
gprof found that most cpu time was spent around 'check_preedit'
I placed checkpoints (printfs) over code and found that after pressing
Enter key event reissued many times, that caused high cpu load.
Then compared code of mousepad with leafpad's one and noticed
that leafpad passes NULL instead of pointer to string, so I commented
out that piece of code in mousepad too. Assumed strlen(str) must be
non-zero and changed default return value to TRUE (that was wrong).
That caused immediate return after testing check_preedit() return value.
After uncommenting code in check_preedit I forgot to remove "return TRUE;"
line. And that was the only change in mousepad's code then. Suprisingly
it worked just as I want. That wrong return statement caused part of code
to be jumped over, so I tried to understand what that code does and
noticed those &=. Variable `event' is passed by reference so changing its
content apparently a mistake I thought.
Something like this.