DiscussionsIssue archiveOCCT:Visualization

Archived issue #0023889

Assignment of function parameter has no effect outside the function.

CommunityOCCT:Visualizationclosed12 public notes

Search issues

Description

In Voxel_ROctBoolDS.cxx, in line 91:

data = 0;


The method:

static void SetZeroSplitData(Voxel_SplitData* data)

would have to take - Voxel_SplitData** data - as parameter in order to nullify the pointer. I'm not sure if this is necessary/intended.

Public activity

12 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Many thanks for the found bug! Indeed, the code is not quite correct. In spite of the method deletes the underlying data, assignment of the data to 0 has no effect outside of the method, as you noticed. So, in order to make as less changes as possible I added an ampersand:

static void SetZeroSplitData(Voxel_SplitData*& data)

Do you agree, Author? Let me know please if you see a better idea. Any remarks are welcome! :-)
02Commenter 1
As usual, I forgot to say that the changes are in CR23889.
03Author
Dear vro,

the patch looks good. cppcheck does not complain any more.

Thanks for correcting!

Unfortunately, I don't have any code using Voxel_ROctBoolDS at the moment. Currently, I have tested Voxel_BoolDS with Voxel_BooleanOperation and I can observe some problems (the results are not OK, visually) but haven't investigated that further.

However, I might post some new bugs concerning this issue;)
04Author
No remarks, please test.
05Commenter 1
Hello Author,
Any your remarks are welcome! Send them via this thread please as a feedback or somehow else as you prefer.
By the way, all Voxel functionality is called by means of a set of draw-commands starting with "voxel*". In particular, the Voxel_ROctBoolDS class is called from voxelroctboolds draw-command (see ViewerTest::VoxelCommands.cxx if you are interested in).
Have a good day,
Vro.
06Author
A crash occurs in SetZeroSplitData when ~Voxel_ROctBoolDS() is called.

There is something wrong here. I'll try to investigate.
07Author
I guess the afore mentioned crash is caused by something else so I propose to test.
08Commenter 2
There are compile errors on Linux platform (on WNT everything is ok):

../../../src/Voxel/Voxel_ROctBoolDS.cxx: In member function 'void Voxel_ROctBoolDS::SetZero()':
../../../src/Voxel/Voxel_ROctBoolDS.cxx:103: error: invalid initialization of non-const reference of type 'Voxel_SplitData*&' from a temporary of type 'Voxel_SplitData*'
../../../src/Voxel/Voxel_ROctBoolDS.cxx:81: error: in passing argument 1 of 'void SetZeroSplitData(Voxel_SplitData*&)'
09Commenter 1
Dear Apn,
Could you please try to recompile the Voxel package again on Linux? I redesigned it so that it should compile on any platform, I think so.
The branch is CR23889 (same).
Thanks in advance,
Vro
10Commenter 2
There is compile error on Linux platform again.

../../../../src/Voxel/Voxel_ROctBoolDS.cxx: In member function ‘void Voxel_ROctBoolDS::SetZero()’:
../../../../src/Voxel/Voxel_ROctBoolDS.cxx:103: error: lvalue required as left operand of assignment
11Commenter 2
Compile error was fixed in branch CR23889
12Commenter 2
Dear Commenter 3,

Branch CR23889 (and products from GIT master) was compiled on Linux and Windows platforms and tested with rebase.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 7 (7 on master)

products component :
Linux: 0 (0 on master)
Windows: 63 (63 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 366393304 / 366250700
Total CPU difference: 39438.02000000052 / 43687.11000000146

Testing on Windows:
Total MEMORY difference: 421861908 / 423428180
Total CPU difference: 37359.6875 / 31296.5

There are not serious differences in images found by testdiff.

Related records