Assertion on IxValidatorX.cpp, line 78

Forum for posting problems using QxOrm library

Assertion on IxValidatorX.cpp, line 78

Postby lixb » Tue Feb 22, 2022 11:56 am

Hi,

I meet an Assert Error in file IxValidatorX.cpp, line 78, when running an insert-query.
ASSERT: "m_pClass" in file ../QxOrm/src/QxValidator/IxValidatorX.cpp, line 78

code:
Code: Select all
template<class T>
void dbInsert(QList<T> &daoList){
    QSqlDatabase db = qx::QxSqlDatabase::getDatabase();
    QSqlError sqlError = qx::dao::insert(daoList, &db);
    ...
}


The assert occurs, not every time, when qx::dao::insert(daoList, &db) is called.
dbInsert(QList<T> &daoList) may be called in several threads. daoList has been checked already.

Could you please tell me what's happening and how to fix it?

Thank you!
lixb
 
Posts: 4
Joined: Tue Feb 22, 2022 9:33 am

Re: Assertion on IxValidatorX.cpp, line 78

Postby qxorm » Mon Feb 28, 2022 4:19 pm

Hello,
not every time

This is strange, I don't understand what could be wrong.
Have you written some validators methods for your persistent classes ?

Anyway, maybe you could try to register all QxOrm context at the beginning of your program (in your main function for example, or where you initialize your database connexion) :
Code: Select all
// Following command is recommanded to initialize QxOrm introspection engine
qx::QxClassX::registerAllClasses(true);
qxorm
Site Admin
 
Posts: 479
Joined: Mon Apr 12, 2010 7:45 am

Re: Assertion on IxValidatorX.cpp, line 78

Postby lixb » Tue Mar 01, 2022 6:19 am

Thanks for your reply.
No validator methods written. And qx::QxClassX::registerAllClasses() is already called in main function. :(
lixb
 
Posts: 4
Joined: Tue Feb 22, 2022 9:33 am

Re: Assertion on IxValidatorX.cpp, line 78

Postby qxorm » Tue Mar 01, 2022 1:23 pm

Maybe you could try to :
- after calling qx::QxClassX::registerAllClasses(true); in your main function,
- add something like this :
Code: Select all
qx::QxCollection<QString, qx::IxClass *> * pAllClasses = qx::QxClassX::getSingleton()->getAll();
for (long k = 0; k < pAllClasses->count(); k++) {
   qx::IxClass * pClass = pAllClasses->getByIndex(k); if (! pClass) { continue; }
   pClass->getAllValidator(); // this line should initialize the 'm_pClass' variable where your assertion is thrown
}


If it resolves your issue, I will add it inside the 'registerAllClasses()' method for the next version.
qxorm
Site Admin
 
Posts: 479
Joined: Mon Apr 12, 2010 7:45 am

Re: Assertion on IxValidatorX.cpp, line 78

Postby lixb » Thu Mar 03, 2022 12:43 am

Got it.
It may take several days to confirm. I will let you know.
lixb
 
Posts: 4
Joined: Tue Feb 22, 2022 9:33 am

Re: Assertion on IxValidatorX.cpp, line 78

Postby lixb » Tue Mar 15, 2022 9:28 am

qxorm wrote:Maybe you could try to :
- after calling qx::QxClassX::registerAllClasses(true); in your main function,
- add something like this :
Code: Select all
qx::QxCollection<QString, qx::IxClass *> * pAllClasses = qx::QxClassX::getSingleton()->getAll();
for (long k = 0; k < pAllClasses->count(); k++) {
   qx::IxClass * pClass = pAllClasses->getByIndex(k); if (! pClass) { continue; }
   pClass->getAllValidator(); // this line should initialize the 'm_pClass' variable where your assertion is thrown
}


If it resolves your issue, I will add it inside the 'registerAllClasses()' method for the next version.


It works! Thank you!
lixb
 
Posts: 4
Joined: Tue Feb 22, 2022 9:33 am


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 1 guest