| Summary: | false positive for writing to temporary QTextTableCell::setFormat | ||
|---|---|---|---|
| Product: | [Developer tools] clazy | Reporter: | eric.lemanissier |
| Component: | general | Assignee: | Unassigned bugs <unassigned-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | smartins |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Other | ||
| Latest Commit: | http://commits.kde.org/clazy/16084d3512cbe6cb163418766447d476b70f6213 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
Git commit 16084d3512cbe6cb163418766447d476b70f6213 by Sergio Martins. Committed on 26/05/2016 at 14:52. Pushed by smartins into branch 'master'. writing-to-temporary: Whitelist QTextTableCell It's an indirection to QTextTable so it's fine M +1 -1 checks/writingtotemporary.cpp http://commits.kde.org/clazy/16084d3512cbe6cb163418766447d476b70f6213 The commit did not change the problem on my side. Lookup at the source of WritingToTemporary, "QTextTableCell" was added to "isKnownType" function. I may be mistaken, but it looks like it should have been added to "isDisallowedClass" Git commit e3fd94c73311f737f692e434a683e2c2c6bcfb62 by Sergio Martins. Committed on 30/05/2016 at 20:20. Pushed by smartins into branch 'master'. writing-to-temporary: Correctly fix QTextTableCell false-positive This time with unit-test. M +3 -2 checks/level0/writingtotemporary.cpp M +9 -1 tests/writing-to-temporary/main.cpp http://commits.kde.org/clazy/e3fd94c73311f737f692e434a683e2c2c6bcfb62 |
Calling setFormat on a temporary QTextTableCell raises "Call to temporary is a no-op", but it is not, because QTextTableCell is just an indirection to the underlying QTextTable. all other QTextTableCell members are const, so they are no-ops if the return value is ignored Reproducible: Always Steps to Reproduce: QTextCursor cursor; QTextTableCellFormat cellFormat; // ... QTextTable *currentTable = cursor.currentTable(); currentTable->cellAt(cursor).setFormat(cellFormat); Actual Results: warning: Call to temporary is a no-op: QTextTableCell::setFormat [-Wclazy-writing-to-temporary] currentTable->cellAt(cursor).setFormat(cellFormat); ^