Skip to content

Commit

Permalink
Fix ped plugin (#620)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
These changes address a memory leak in the WebService/PSM functionality
of the plugin. It also allows a user to switch between using
FLIR(WebSocket) and PSM(WebService) without crashing or generating
segmentation faults.

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->
#497 

## Motivation and Context

Users of this plugin have noticed memory loss and error code generation
while using this plugin. Users have also requested a fix for the #497
issue.

## How Has This Been Tested?
Tested using a script to send 1000 PSM XMLs to the plugin. No messages
were lost.
Tested using local FLIR camera to ensure functionality was maintained. 

Switched between DataProviders (PSM/FLIR) in various combinations to
ensure threads were closed or joined properly.

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [X] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [X] I have read the **CONTRIBUTING** document.
[V2XHUB Contributing
Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md)
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
  • Loading branch information
jwillmartin authored Aug 16, 2024
1 parent be5a5af commit eb539af
Show file tree
Hide file tree
Showing 14 changed files with 282 additions and 14,213 deletions.
2 changes: 1 addition & 1 deletion examples/tmx-exampleapps/EmptyPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ PROJECT ( EmptyPlugin VERSION 3.0.0 LANGUAGES CXX )

BuildTmxPlugin ( )

TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils pugixml)
2 changes: 1 addition & 1 deletion examples/tmx-exampleapps/EmptyPlugin/src/EmptyPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <AppAlert.h>
#include <algorithm>
#include <tmx/messages/message_document.hpp>
#include <tmx/pugixml/pugixml.hpp>
#include <pugixml.hpp>
#include <ParsedMap.h>
#include <MapSupport.h>
#include <sstream>
Expand Down
8 changes: 8 additions & 0 deletions ext/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ make -j${numCPU}
make install
popd

# pugixml
pushd /tmp
git clone https://github.com/zeux/pugixml.git --branch v1.14
cd pugixml
cmake .
make -j${numCPU}
make install
popd
4 changes: 2 additions & 2 deletions src/tmx/TmxApi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ IF (NOT TMXAPI_NO_STATIC)
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME}Static SYSTEM PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
${Boost_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES (${PROJECT_NAME}Static ${ASN_J2735_LIBRARIES} ${Boost_LIBRARIES} ${ICU_LIBRARIES})
TARGET_LINK_LIBRARIES (${PROJECT_NAME}Static ${ASN_J2735_LIBRARIES} ${Boost_LIBRARIES} ${ICU_LIBRARIES} pugixml)
IF (Boost_DEFS)
TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME}Static PUBLIC ${Boost_DEFS})
ENDIF (Boost_DEFS)
Expand All @@ -68,7 +68,7 @@ IF (NOT TMXAPI_NO_SHARED)
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} SYSTEM PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
${Boost_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES (${PROJECT_NAME} PUBLIC ${ASN_J2735_LIBRARIES} ${Boost_LIBRARIES} ${ICU_LIBRARIES})
TARGET_LINK_LIBRARIES (${PROJECT_NAME} PUBLIC ${ASN_J2735_LIBRARIES} ${Boost_LIBRARIES} ${ICU_LIBRARIES} pugixml)
IF (Boost_DEFS)
TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME} PUBLIC ${Boost_DEFS})
ENDIF (Boost_DEFS)
Expand Down
2 changes: 1 addition & 1 deletion src/tmx/TmxApi/tmx/messages/message_document.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stdexcept>

#include <tmx/messages/message.hpp>
#include <tmx/pugixml/pugixml.hpp>
#include <pugixml.hpp>

namespace tmx {

Expand Down
74 changes: 0 additions & 74 deletions src/tmx/TmxApi/tmx/pugixml/pugiconfig.hpp

This file was deleted.

Loading

0 comments on commit eb539af

Please sign in to comment.