Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re fix for issue #53. Two problems #148

Closed
MichaelAtOz opened this issue Jul 16, 2012 · 10 comments
Closed

Re fix for issue #53. Two problems #148

MichaelAtOz opened this issue Jul 16, 2012 · 10 comments

Comments

@MichaelAtOz
Copy link
Member

After testing the fix for issue 53, OpenSCAD 2012.17.15 has two reproducible issues - so far.

A .scad based on Thingiverse Thing 14728, with minor modification - different number. (just confirmed it happens with the vanilla Thing)

With version 2011.12.30 when Compiled it correctly shows the text on the badge.

With 2012.17.15 the text does not display - just the badge, then when Rendering it gets:

MS V C++ Runtime Library Dialog Box;
Assertion failed!
Program: .../openscad.exe
File: /home/dond/mxe/usr/lib/gcc/i686-pc.../shared_ptr.hpp
Line: 424
Expression: px != 0
For infomation blah blah
Abort/Retry/Ignore

Retry & Ignore then crashes OpenSCAD.

There was also one case of a crash when loading this Thing & Auto compiling, detailed in Issue #53, so far only a single instance, it was after editing a number of other files.

@donbright
Copy link
Sponsor Member

i confirm here that 2011.12 works and 2012.7.15 doesnt.

backtrace from linux crash

[New Thread 0xb08a2b40 (LWP 22316)]
openscad: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr::operator->() const [with T = CGAL::Nef_polyhedron_3CGAL::Cartesian<CGAL::Gmpq >]: Assertion `px != 0' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb08a2b40 (LWP 22316)]
0xb7fdd424 in __kernel_vsyscall ()
(gdb) bt
#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xb6a4e1ef in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xb6a51835 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0xb6a47095 in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0xb6a47147 in __assert_fail () from /lib/i386-linux-gnu/libc.so.6
#5 0x08127447 in boost::shared_ptrCGAL::Nef_polyhedron_3<CGAL::Cartesian<CGAL::Gmpq, CGAL::SNC_indexed_items, bool> >::operator-> (this=0xb08a1828) at /usr/include/boost/smart_ptr/shared_ptr.hpp:418
#6 0x081def53 in CGALEvaluator::visit (this=0xb08a20cc, state=..., node=...) at src/CGALEvaluator.cc:289
#7 0x080d1794 in TransformNode::accept (this=0x8ff2150, state=..., visitor=...) at src/transformnode.h:13
#8 0x08109907 in Traverser::traverse (this=0xb08a2090, node=..., state=...) at src/traverser.cc:41
#9 0x08109800 in Traverser::traverse (this=0xb08a2090, node=..., state=...) at src/traverser.cc:30
#10 0x08109800 in Traverser::traverse (this=0xb08a2090, node=..., state=...) at src/traverser.cc:30
#11 0x08109800 in Traverser::traverse (this=0xb08a2090, node=..., state=...) at src/traverser.cc:30
#12 0x08109800 in Traverser::traverse (this=0xb08a2090, node=..., state=...) at src/traverser.cc:30
#13 0x08109800 in Traverser::traverse (this=0xb08a2090, node=..., state=...) at src/traverser.cc:30
#14 0x08109800 in Traverser::traverse (this=0xb08a2090, node=..., state=...) at src/traverser.cc:30
#15 0x081095f3 in Traverser::execute (this=0xb08a2090) at src/traverser.cc:11
#16 0x081dd0f0 in CGALEvaluator::evaluateCGALMesh (this=0xb08a20cc, node=...) at src/CGALEvaluator.cc:44
#17 0x083f5f0c in CGALWorker::work (this=0x8b0bf10) at src/cgalworker.cc:32
#18 0x083f76a7 in CGALWorker::qt_static_metacall (_o=0x8b0bf10, _c=QMetaObject::InvokeMetaMethod, id=2, a=0xb08a21f0)
at objects/moc_cgalworker.cpp:56
#19 0xb6f716b1 in QMetaObject::activate(QObject
, QMetaObject const
, int, void**) ()
from /usr/lib/i386-linux-gnu/libQtCore.so.4
#20 0xb6fc1265 in QThread::started() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#21 0xb6e45dbf in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#22 0xb6cfbd4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#23 0xb6b0aace in clone () from /lib/i386-linux-gnu/libc.so.6

which is right here at the 'transform' line

   CGAL_Aff_transformation t(
    node.matrix(0,0), node.matrix(0,1), node.matrix(0,2), node.matrix(0,3),
    node.matrix(1,0), node.matrix(1,1), node.matrix(1,2), node.matrix(1,3),
    node.matrix(2,0), node.matrix(2,1), node.matrix(2,2), node.matrix(2,3), node.matrix(3,3));

289> N.p3->transform(t);

@donbright
Copy link
Sponsor Member

crash also happens on master branch from date 2012-03-10

crash also happens on 'cgalpngtest' from the testsuite.

crash also happens on 64 bit AMD/intel and 32 bit x86 linux

crash also on 64 bit PPC linux


git checkout from 2012 02 20 - crashes
git checkout from 2012 02 18 - works
git checkout from 2012 02 15 - works
git checkout from 2012 02 10 - works
git checkout from 2012 01 20 - works

2012-2-19 HEAD from c5703b4 ---- crash

@kintel
Copy link
Member

kintel commented Jul 17, 2012

I can confirm that the text doesn't show on master.
The release build crashes on Mac, the debug build not. This sounds like a fun CGAL issue to debug :/

@donbright
Copy link
Sponsor Member

ok first problem i see....

apparently N.dim3 being true does not always guarantee that N.p3 will be OK. i inserted some printfs into CGAL_Nef_Polyhedron::copy and its clearly showing that both p2 and p3 are 0 while 'dim' still says '3'

interesting that they become 0 after this message from OpenSCAD:

Warning: Scaling a 3D object with 0 - removing object


@donbright
Copy link
Sponsor Member

by removing this single line, the bug disappears.

from CGALEvaluator.cc:

      PRINT("Warning: Scaling a 3D object with 0 - removing object");
      N.p3.reset();

change to

      PRINT("Warning: Scaling a 3D object with 0 - removing object");
      //N.p3.reset();

the crash is no longer there. however the output is now kind of garbled, the letters dont appear properly.

@kintel
Copy link
Member

kintel commented Jul 17, 2012

A better fix would be to set N.dim = 0; after the reset() - for both the 2D and 3D case.
That should get you a bit further.

@donbright
Copy link
Sponsor Member

isolated a little bit.

minimal example:

scale([8,8,0])
linear_extrude(file="circle.dxf");

where circle.dxf is from openscad/testdata/dxf/circle.dxf

the last version that works can be built by this:

git checkout 955e0f1

In CGALEvaluator.cc, comparison of the node->matrix.toString() right before the 3d transformation involved gives this:

old openscad (works): multmatrix([[8, 0, 0, 0], [0, 8, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
new openscad (crash): multmatrix([[8, 0, 0, 0], [0, 8, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]])

the determinant() of old openscad matrix is 64. and it has no 'reset()' for the Nef Polyhedron.

the determinant() of new openscad matrix is 0, so the Nef_Polyhedron does get reset(), and we have the stuff we have discussed above (dim==3, etc).

Curiouser and curiouser.

@donbright
Copy link
Sponsor Member

from what i can tell, old openscad was taking 'scale 8,8,0' and making it into 'scale 8,8,1'. happens in transform.cc

this was changed in patch c5703b4

to maintain backwards compatability, it seems like new openscad would have to do the same thing, altering 'scale()' input so that zeroes become ones.

but if you just want to fix printrbot.scad, you can do this

sed -i s/"scale_y,0"/"scale_y,1"/g printrbot.scad

this will make printrbot work fine in the new openscad (without patching)

i am submitting a small patch that will prevent openscad from crashing when '0' is given to scale .. . but i will have to leave the backwards compatability issue for others to discuss

@donbright donbright mentioned this issue Jul 20, 2012
@MichaelAtOz
Copy link
Member Author

Thanks Don, did that and it no longer crashes.

I did not another issue though, Compile does not show the RoundedCornersCube (just a cube) or the two holes, only after rendering do you see it, unlike the old version. I will raise another issue.

ps I presume I should not close this issue?

@donbright
Copy link
Sponsor Member

so since several people have said 'scale 0' should throw a warning, but produce no output, i will close this... and consider the new issue to be #166 , the lack of proper warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants