Questions regarding compiler warnings
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Wed Feb 12 19:53:14 UTC 2020
Le 12/02/2020 à 20:45, Stephan Witt a écrit :
> 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
I already answered this one :)
>
> 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?
The patch looks good to me.
>
> 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.
This is inconsistent indeed.
>
> 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.
Are these the insets that support completion? This is tested above,
then. You can set position to 0 in order to please the compiler, I guess.
More information about the lyx-devel
mailing list