-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
htop quits unexpectedly after SortBy (with workaround) #2
Comments
The fuFunctions array for the Sort Screen's FunctionBar is not ended with a NULL Pointer, thus strdup reads from invalid address when creating this FunctionBar. The following patch (unified diff) adds a NULL Pointer to the two fuFunctions arrays in htop.c not ending in an NULL pointer: --- htop.c.orig 2010-01-13 18:04:07.000000000 +0100
|
Sorry, I forgot the tags!--- htop.c.orig 2010-01-13 18:04:07.000000000 +0100 +++ htop.c 2010-01-13 15:29:55.000000000 +0100 @@ -651,7 +651,7 @@ Panel* affinityPanel = AffinityPanel_new(pl->processorCount, curr); - char* fuFunctions[2] = {"Set ", "Cancel "}; + char* fuFunctions[] = {"Set ", "Cancel ", NULL}; void* set = pickFromVector(panel, affinityPanel, 15, headerHeight, fuFunctions, defaultBar); if (set) { unsigned long new = AffinityPanel_getAffinity(affinityPanel); @@ -690,7 +690,7 @@ { Panel* sortPanel = Panel_new(0, 0, 0, 0, LISTITEM_CLASS, true, ListItem_compare); Panel_setHeader(sortPanel, "Sort by"); - char* fuFunctions[2] = {"Sort ", "Cancel "}; + char* fuFunctions[] = {"Sort ", "Cancel ", NULL}; ProcessField* fields = pl->fields; for (int i = 0; fields[i]; i++) { char* name = String_trim(Process_fieldTitles[fields[i]]); |
AndyA can you add this patch to your repo? |
how can I apply that patch to my copy? |
Something like: `patch -u < FILE'. See the patch man-page for more details. |
I can confirm that applying this patch worked for me. Thanks! |
See my recent comment/pull request for the applied patch. Hopefully AndyA will accept it since I like htop on osx and this was the one bug that was buggin' me. :) |
Just after pressing F6 (SortBy) command htop quits printing following to the console: "htop 0.8.2.1 aborted. Please report bug at http://htop.sf.net". This happens with self-built htop from Git source as well as with the one that comes from MacPorts.
There's a workaround, after starting htop open "Kill" menu, and then cancel. After this, sort works fine.
The text was updated successfully, but these errors were encountered: