Questions regarding compiler warnings
Stephan Witt
st.witt at gmx.net
Wed Feb 12 19:45:56 UTC 2020
Hi all,
I've recently upgraded some parts of my tool box. I’m seeing new warnings now.
1. deprecated warning (removed with C++17?)
lyx/src/insets/InsetCommandParams.cpp:596:9: warning: 'mem_fun_ref<bool, lyx::ParamInfo::ParamData>' is deprecated
2. various memory leak warnings
E.g. in GuiDocument::updateAvailableModules() - src/frontends/qt/GuiDocument.cpp, line 4474
There is an allocation here:
QStandardItem * catItem = new QStandardItem();
and later an assignment here:
catItem = fcats.first();
See the attached nice picture…
Should this be changed with the attached patch?
Similar problems are reported
- in GuiLyXFiles::updateContents() with
+ QTreeWidgetItem * catItem - line 421
+ QTreeWidgetItem * subcatItem - line 447
- in GuiToolbar::add() with
+ InsertTableWidget * iv - line 495 (here I’m not sure)
3. NULL pointer usage
In GuiView::dispatchVC are different buffer pointer variables used.
Sometimes there is an explicit check for NULL value.
Sometimes there is an assertion with break or return for release builds.
This looks inconsistent.
4. using uninitialized variable
In GuiCompleter::asyncUpdatePopup the x and y position are declared w/o initial value.
The virtual Inset::completionPosAndDim() method body is empty for common case.
Only InsetText, InsetTabular, InsetMathMacro and InsetMathNest have an assignment.
For all other insets (I didn't check if this is possible) the QRect results in garbage.
Best regards,
Stephan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GuiDocument-memleak.patch
Type: application/octet-stream
Size: 800 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200212/41cad6ef/attachment-0001.obj>
-------------- next part --------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto 2020-02-12 um 12.34.49.png
Type: image/png
Size: 179430 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200212/41cad6ef/attachment-0001.png>
More information about the lyx-devel
mailing list