Summary: | KSysGuard crashes in KSignalPlotter::beamColor() on exit after importing sheet | ||
---|---|---|---|
Product: | [Applications] ksysguard | Reporter: | Jonathan Thomas <echidnaman> |
Component: | general | Assignee: | KSysGuard Developers <ksysguard-bugs> |
Status: | RESOLVED DUPLICATE | ||
Severity: | crash | CC: | andresbajotierra, lotusom-dev |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
Worksheet that produces crash on exit after editing
Proposed patch |
Description
Jonathan Thomas
2009-02-20 20:38:36 UTC
Created attachment 31503 [details]
Worksheet that produces crash on exit after editing
I just analyzed this: When removing a beam from the plotter which is not the last... the indexes are not updated to match the mBeamColors list index. So , in this case, removing the first beam will do this: The sensors indexes will be 1,2,3 (0 was removed) mBeamColors indexes will be 0,1,2 (as removing a item in a list doesn't preserve the index/position) When accessing the sensor index "3" , mBeamColors.at(3) will crash as it is a non existant index Possible solutions: - Update the sensors indexes on removing a beam - Use "replace" instead of "remove" on mBeamColors to preserve the indexes position - Use a QMap<index,QColor> instead a QList<QColor> Or, using the mBeams indexes on save (instead of the sensors indexes) But it seems there is a strange relationship I can't tell by just looking at the code without knowing it Created attachment 33982 [details]
Proposed patch
This will modify the sensors() beamId to match the m_beamColors/Data indexes.
I don't know if this will cause side effects, I just tested it and it works, it doesn't seem to affect other parts of the application and it doesn't crash anymore.
Fix and patch for code rewrite provided here https://bugs.kde.org/show_bug.cgi?id=179305 *** This bug has been marked as a duplicate of bug 179305 *** |