this is one of my strangest errors.
QRegularExpression regexp(" .*");
This works fine, sometimes. But than it crashes with segmentation faul.
0 _int_malloc /usr/lib64/libc.so.6 0x7ffff59f2196
1 malloc /usr/lib64/libc.so.6 0x7ffff59f411c
2 operator new(unsigned long) /usr/lib64/libstdc++.so.6 0x7ffff62ac0cd
3 QRegularExpression::QRegularExpression(QString const&, QFlags<QRegularExpression::PatternOption>) /usr/lib64/libQt5Core.so.5 0x7ffff6b45fdd
The Strange thing ist, if i start the program sometimes its okay! No Error at all. Sometime its crashes after this loc was excecuted excacly 71 times.
I just dont have any clue -.-
EDIT:
char hname[255] ="";
char hname80[255] ="";
char hcas[255] = "";
int i = number;
NAMEdll(i,hname,hname80,hcas);
shortName=hname;
fullName=hname80;
cas=hcas;
// remove unecessary spaces
QRegularExpression regexp(" .*");
cas.remove(regexp);
shortName.remove(regexp);
fullName.remove(regexp)
like suggested i removed code to find the error. Its seems to have something to do with NAMEdll ( which is a fortran function). If i take out this command, its all fine. With it i get this:
0 _int_malloc /usr/lib64/libc.so.6 0x7ffff59f2196
1 malloc /usr/lib64/libc.so.6 0x7ffff59f411c
2 QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) /usr/lib64/libQt5Core.so.5 0x7ffff6a7c0f6
3 QRegularExpressionMatchPrivate::QRegularExpressionMatchPrivate(QRegularExpression const&, QString const&, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>, int) /usr/lib64/libQt5Core.so.5 0x7ffff6b4617a
4 QRegularExpression::match(QString const&, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>) const /usr/lib64/libQt5Core.so.5 0x7ffff6b475e4
5 QRegularExpression::globalMatch(QString const&, int, QRegularExpression::MatchType, QFlags<QRegularExpression::MatchOption>) const /usr/lib64/libQt5Core.so.5 0x7ffff6b47c77
6 QString::replace(QRegularExpression const&, QString const&) /usr/lib64/libQt5Core.so.5 0x7ffff6b1c4a9
7 QString::remove qstring.h 429 0x4852fe
Just guessing, but is there a chance that inside the fortran code (its not my ) something can cause a malloc call to fail ? And if it is so, can someone explain how ?
EDIT:
Solved: Okay i found it by accident. In a diffrent part of the program i had the following code:
char href[3] ="";
strcpy(href,"DEF");
This is bad, cause strcpy also writes an end character '\0'. So the written chararray has the length of 4.