高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】crash in circleproc
crash in circleproc?
crash in circleproc?
hi,
i am upgrading from 1.12.04 to 2.3.0 and i have everything seemingly working except for circles. a call to:
odgigeometrysimplifier::circleproc(center, radius, normal, pextrusion);
causes an error "access violation reading location 0x00000000"
the top of the call stack is:
circlearcfillmode(blah blah) line 516 + 0x1a but i don't have gigeometrysimplifier.cpp so it's a mystery to me.
can someone shed some light on the problem?
thanks!
daniel
hi,
code:
inline bool circlearcfillmode(odgigeometrysimplifier* pgs)
{
return pgs->rendermode() == odgsview::k2doptimized && pgs->drawcontext()->effectivetraits().filltype() == kodgifillalways;
}
void odgigeometrysimplifier::circleproc(const odgepoint3d& center, double radius, const odgevector3d& normal, const odgevector3d* pextrusion)
{
odgecircarc3d circarc(center, normal, radius);
odgepoint3darray points;
circarc.appendsamplepoints(0., oda2pi, deviation(kodgimaxdevforcircle, center), points);
points.last() = points.first();
if (!circlearcfillmode(this))
{
polylineproc(points.size(), points.getptr(), &normal, pextrusion);
}
else
{
polygonproc(points.size(), points.getptr(), &normal, pextrusion);
}
}
i think that somewhere null pointer was used. try to locate problem with help of included 'sources'.
if your application was based on ddtoolkit sample, check changes in this sample.
line 516 is
return pgs->rendermode() == odgsview::k2doptimized && pgs->drawcontext()->effectivetraits().filltype() == kodgifillalways;
thanks alexander!
drawcontext() was returning null
a call to setdrawcontext in update() fixed my mistake. too easy!
|