Page 1 of 1

Load file crash

Posted: Fri Oct 16, 2020 2:51 am
by kasper

Code: Select all

BinFilter bin;   
BinFilter::LoadParameters lp;
lp.alwaysDisplayLoadDialog = false;
CC_FILE_ERROR error = bin.loadFile(filename, *obj, lp);
if I Input a file incomplete file or something that cloudcompare cannot read, it won't return an errorcode.
the result I got is the program crash.

How to fix this problem? ( also in StlFilter or PlyFilter )

Re: Load file crash

Posted: Fri Oct 16, 2020 4:33 pm
by daniel
Is it in your own environment? Do you have a valid qApp?

Re: Load file crash

Posted: Mon Oct 19, 2020 9:02 am
by kasper
Yes, coding in Ubuntu 18.04.

"Do you have a valid qApp?" <- sorry, what's that mean?


If i create a txt file and modify the filename extension from txt to stl.
And I load it by the code

Code: Select all

 bin.loadFile(filename, *obj, lp);
it crash.

Re: Load file crash

Posted: Mon Oct 19, 2020 2:36 pm
by daniel
1) Since everything is built with Qt, you need a properly initialized QApplication (Qt application) instance if you want to see error popus, and working slots/signals, etc.

2) The BinFilter class can only be used to load BIN files (you'll need the AsciiFilter to load ascii/txt files, and STLfilter to load STL files). And if the call crashes, see 1 (at least that's what I suspect).

Re: Load file crash

Posted: Tue Oct 20, 2020 9:48 pm
by kasper
great! thanks Daniel.