복잡한 오류가 발생했습니다. 소프트웨어는 PrintParamters를 프린터로 몇 번 전송합니다. 특정 순간에 Parameter Struct의 모든 QString이 손상됩니다 (불량 ptr)QString이 때때로 구조체에 bad-ptr을 갖는 이유는 무엇입니까?
Structs의 QString에 일반적인 문제가 있습니까?
void
MyDlg::UpdateRecorderPrintParameters()
{
RecorderPrintParam param;
....
....
param.xname = QString("abc def 123");
_recorder->setParam(¶m);
}
param.xname 이미 가지고는 GUI 클래스에서 호출 :
여기typedef struct RecorderPrintParam {
ES_DataType xxxxxxxxxx;
bool xxxxxxxxxxx;
bool xxxxxxxxxxxx;
bool xxxxxxxxxxxx;
int xxxxxxxxxxxxxxxxxxxxxx;
double xxxxxxxxxxxxxxx;
double xxxxxxxxxx;
bool xxxxxxxxxxx;
int xxxxxxxxxxxxxxx;
double xxxxxxxxxxx;
bool xxxxxxxxxxx;
bool xxxxxxxxxx;
double xxxxxxxxx;
QString xname;
QString yname;
QString anotherValue;
QString opername;
QString region;
QString application;
QString version;
AxisUnit axUnit ;
double axLenM;
double xxxxxxxx;
double xxxxxxxx;
int xxxxxxxx;
double xxxxxxxxx;
double xxxxxxxxx;
bool xxxxxxxxxxxxxxx;/
double xxxxxxxxxxxxxxx;
double xxxxxxxxxx;
bool xxxxxxxxx;
}RecorderPrintParam;
이 구조체가 사용되는 방법입니다 : 여기
은 내가 사용 구조체입니다 나쁜 ascii ptr !! ? 또한 QString ("abc def 123") 대신 "abc def 123"을 사용하려고했습니다. 하지만 발생하는 동일한 오류의이 같은 setParam 기능이 모습입니다 : XName이 여전히 그 순간 "8xname = {D = 0x08e2d568}"에서 주소가
RecorderInterface::setParam(RecorderPrintParam *up)
{
....
...
if(up->xname.compare(_myParams.xname)!=0) _newHeaderPrint=true;
...
...
}
}
하지만 xname.ascii가있다 0x00000000의 포인터
또한이 구조체를 사용하는 방법을 나타내는 코드를 게시해야합니다. 예 : 그것은 동적으로 할당됩니까? – Alon
좋아요, 내 게시물 – Christoferw
이러한 정보를 기반으로 어떤 아이디어를 updatet있어? – Christoferw