简体   繁体   中英

Qt5Cored!Qobject::disconnect… read access violation at 0x0

The following describes the issue and what I did to "correct" them. This runtime event required a few hours of time to resolve. As the site is one of my favorite sources of information, thought this might benefit someone.

I am sure this exception was created by my misunderstanding of QObjectCleanupHandler. Any constructive comments on a practical implementation of QObjectCleanupHandler would be appreciated.

-- Added QObjectCleanupHandler with QPointer<> to a MDI subwindow and a worker class.

  • run-DEBUG the application.

at the end of the run:

A dialog is raised with what appears to be assembly stack data.

Checked the debug log in QT Creator Menu: Windows\\Views\\Debugger Log\\

Log Snippet:

Move to bottom

::::

Snippet:

Move to bottom

dState changed from InferiorRunRequested(10) to InferiorRunOk(11) [master] (1d84.1720): Access violation - code c0000005 (first chance) s sException at 0x67343a9c, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance) at c:\\work\\build\\qt5_workdir\\w\\s\\qtbase\\src\\corelib\\kernel\\qobject.cpp:2813 First chance exceptions are reported before any exception handling. This exception may be expected and handled. eax=03f160f1 ebx=00000000 ecx=03f3b728 edx=feeefeee esi=00000005 edi=00000000 eip=67343a9c esp=0046d1b8 ebp=0046d340 iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b
efl=00010202 Qt5Cored!QObject::disconnect+0x2bc: 2813 67343a9c 8b02 mov eax,dword ptr [edx] ds:002b:feeefeee=???????? s sException at 0x67343a9c, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance) dNOTE: INFERIOR SPONTANEOUS STOP sStopped. dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master] Resolving symbol: Qt5Cored!QObject::disconnect...


Source Code Snippet responsible for the exception:

QThread *thread = new QThread;
QPointer<vcSharedDataQt> worker = new vcSharedDataQt();
trackObject(worker);
worker->movetothread(thread); 

trackObject() method is a private field on the QMdiSubWindow

class <form> 
{

 private:

   QObjectCleanupHandler trackObject(QObject obj);


::: etc.

Corrective Action:

Source Code Snippet Changed to:

QThread *thread = new QThread;
QPointer<vcSharedDataQt> worker = new vcSharedDataQt();
worker->movetothread(thread); 

/* removed all instances of QObjectCleanupHandler in all classes. */

QT Environment Defined in Exception: QT KernelBase!RaiseException at 0x759fc41f


I had the same issue once and it came out, that I had to restart QtCreator. After loading my project again, without changing anything in my code, I did not get that error anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM