[mapguide-users] memory leak: IGWSQueryDefinition and FdoFilter

artem artimoshagaming at gmail.com
Wed Sep 16 08:57:38 PDT 2020


Hi all!

FdoFilter * IGWSQueryDefinition::Filter()
function returns "FdoFilter *" that is supposed to be wrapped in
FdoPtr<FdoFilter>, am I right?

then in next places it is not wrapped and causes memory leaks:
============================================
1) MapGuide\Server\src\Gws\GwsQueryEngine\GwsFeatureSourceQuery.cpp
in function:
CGwsPreparedFeatureQuery * CGwsFeatureSourceQuery::PrepareFeatureQuery(...)

we should replace next:
stat = pQuery->Init ( sellist, orderByCols, orderingOption, pFQuery->Filter
());

by:
FdoPtr<FdoFilter> pFilter = pFQuery->Filter();
stat = pQuery->Init(sellist, orderByCols, orderingOption, pFilter);

============================================
2) MapGuide\Server\src\Gws\GwsQueryEngine\GwsQueryDefinition.cpp
in function:
bool
GwsQueryDefinitionXmlHelpers::CompareQueries(IGWSQueryDefinition*
firstQuery, IGWSQueryDefinition* secondQuery)

we should replace next:
if(!GwsQueryDefinitionXmlHelpers::CompareToStringValues(firstQuery->Filter()
, secondQuery->Filter()))

by:
FdoPtr<FdoFilter> pFirstQuryFilter = firstQuery->Filter();
FdoPtr<FdoFilter> pSecondQuryFilter = secondQuery->Filter();
if(!GwsQueryDefinitionXmlHelpers::CompareToStringValues(pFirstQuryFilter.p,
pSecondQuryFilter.p))

I have catched those leaks during connection to SDF provider and after first
fix my leaks dissapeared.
I also have tried to connect to SHP provider with simular code but got
another memory leaks. I haven't figure out where they come from yet, but I
suppose it can be from SHP provider implementation side.
Myabe someone have some information about it?

Best Regards,
Artem



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html


More information about the mapguide-users mailing list