查看单个帖子
旧 2009-05-04, 06:26 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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!
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)