Load file crash

Feel free to ask any question here
Post Reply
kasper
Posts: 29
Joined: Thu May 17, 2018 6:13 am

Load file crash

Post 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 )
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Load file crash

Post by daniel »

Is it in your own environment? Do you have a valid qApp?
Daniel, CloudCompare admin
kasper
Posts: 29
Joined: Thu May 17, 2018 6:13 am

Re: Load file crash

Post 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.
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Load file crash

Post 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).
Daniel, CloudCompare admin
kasper
Posts: 29
Joined: Thu May 17, 2018 6:13 am

Re: Load file crash

Post by kasper »

great! thanks Daniel.
Post Reply