// Well, yes I know I should give the complete code, but it's really huge :(
SelectSource
::SelectSource(QWidget *parent
){
n = 0; // slot re-entrancy counter
...
}
void SelectSource::createToolbar()
{
...
connect(qSliderFocus, SIGNAL(valueChanged(int)), this, SLOT(updateFocusLabel())); // there is no other signal connected to this slot nor any direct call to this slot.
...
}
void SelectSource::updateFocusLabel()
{
if (n)
if (globalConsole)
globalConsole
->sendMsg
(QObject::tr("n==%1, meaning this slot was re-entered before it finished").
arg(n
));
/* Normally impossible to reach. Break Point line was set here */
if (globalConsole)
globalConsole
->sendMsg
(QObject::tr("Start focus loop..."));
n++; // should be == 1, never more
// This calls a DLL function. Content of DLL function closed and unknown to me.
// Note that this dll function has a timeout argument in its parameter.
// This means there is maybe some multithread logic hidden behind. Still, this does not explain why the slot updateFocusLabel() is re-entered.
focusCam();
n--; // must get back to 0.
if (globalConsole)
globalConsole
->sendMsg
(QObject::tr("Stop focus loop."));
}
// Well, yes I know I should give the complete code, but it's really huge :(
SelectSource::SelectSource(QWidget *parent)
: QWidget(parent)
{
n = 0; // slot re-entrancy counter
...
}
void SelectSource::createToolbar()
{
...
connect(qSliderFocus, SIGNAL(valueChanged(int)), this, SLOT(updateFocusLabel())); // there is no other signal connected to this slot nor any direct call to this slot.
...
}
void SelectSource::updateFocusLabel()
{
if (n)
if (globalConsole)
globalConsole->sendMsg(QObject::tr("n==%1, meaning this slot was re-entered before it finished").arg(n)); /* Normally impossible to reach. Break Point line was set here */
if (globalConsole)
globalConsole->sendMsg(QObject::tr("Start focus loop..."));
n++; // should be == 1, never more
// This calls a DLL function. Content of DLL function closed and unknown to me.
// Note that this dll function has a timeout argument in its parameter.
// This means there is maybe some multithread logic hidden behind. Still, this does not explain why the slot updateFocusLabel() is re-entered.
focusCam();
n--; // must get back to 0.
if (globalConsole)
globalConsole->sendMsg(QObject::tr("Stop focus loop."));
}
To copy to clipboard, switch view to plain text mode
org.netbeans.modules.viewmodel.TreeModelNode@e3eed5[Name=, displayName=SelectSource::updateFocusLabel(this=0xc8730e8) at selectsource.cpp:202] C:\\Users\\Matt-usr\\Documents\\CTA\\ProjectFiles\\QtIRView\selectsource.cpp:202
org.
netbeans.
modules.
viewmodel.
TreeModelNode@550a69
[Name
=, displayName
=SelectSource
::qt_metacall(this=0xc8730e8,_c
=QMetaObject::InvokeMetaMethod,_id
=11,_a
=0x22a408
) at moc.
tmp/moc_selectsource.
cpp:107] C
:\\Users\\Matt
-usr\\Documents\\CTA\\ProjectFiles\\QtIRView\moc.
tmp\moc_selectsource.
cpp:107 org.
netbeans.
modules.
viewmodel.
TreeModelNode@11e9fc6
[Name
=, displayName
=QMetaObject::metacall(object
=0xc8730e8,cl
=QMetaObject::InvokeMetaMethod,idx
=38,argv
=0x22a408
) at kernel\\qmetaobject.
cpp:237] C
:\Users\Matt
-usr\Documents\CTA\bin\kernel\\qmetaobject.
cpp:237 org.
netbeans.
modules.
viewmodel.
TreeModelNode@18bb614
[Name
=, displayName
=QMetaObject::activate(sender
=0xc8c45d8,m
=0x13dedc0,local_signal_index
=0,argv
=0x22a408
) at kernel\\qobject.
cpp:3278] C
:\Users\Matt
-usr\Documents\CTA\bin\kernel\\qobject.
cpp:3278 org.
netbeans.
modules.
viewmodel.
TreeModelNode@15f08f9
[Name
=, displayName
=QAbstractSlider::valueChanged(this=0xc8c45d8,_t1
=888) at tmp\\moc\\debug_shared\\moc_qabstractslider.
cpp:182] C
:\Users\Matt
-usr\Documents\CTA\bin\tmp\\moc\\debug_shared\\moc_qabstractslider.
cpp:182 org.
netbeans.
modules.
viewmodel.
TreeModelNode@
464666[Name
=, displayName
=QAbstractSlider::setValue(this=0xc8c45d8,value
=888) at widgets\\qabstractslider.
cpp:543] C
:\Users\Matt
-usr\Documents\CTA\bin\widgets\\qabstractslider.
cpp:543 org.
netbeans.
modules.
viewmodel.
TreeModelNode@1b80e2d
[Name
=, displayName
=QAbstractSlider::triggerAction(this=0xc8c45d8,action
=QAbstractSlider::SliderMove) at widgets\\qabstractslider.
cpp:632] C
:\Users\Matt
-usr\Documents\CTA\bin\widgets\\qabstractslider.
cpp:632 org.
netbeans.
modules.
viewmodel.
TreeModelNode@aac5db
[Name
=, displayName
=QAbstractSlider::setSliderPosition(this=0xc8c45d8,position
=888) at widgets\\qabstractslider.
cpp:500] C
:\Users\Matt
-usr\Documents\CTA\bin\widgets\\qabstractslider.
cpp:500 org.
netbeans.
modules.
viewmodel.
TreeModelNode@1a3c2bf
[Name
=, displayName
=QSlider::mouseMoveEvent(this=0xc8c45d8,ev
=0x22abfc
) at widgets\\qslider.
cpp:514] C
:\Users\Matt
-usr\Documents\CTA\bin\widgets\\qslider.
cpp:514 org.
netbeans.
modules.
viewmodel.
TreeModelNode@46a30e
[Name
=, displayName
=QWidget::event(this=0xc8c45d8,event
=0x22abfc
) at kernel\\qwidget.
cpp:8244] C
:\Users\Matt
-usr\Documents\CTA\bin\kernel\\qwidget.
cpp:8244 org.
netbeans.
modules.
viewmodel.
TreeModelNode@17b28cc
[Name
=, displayName
=QAbstractSlider::event(this=0xc8c45d8,e
=0x22abfc
) at widgets\\qabstractslider.
cpp:942] C
:\Users\Matt
-usr\Documents\CTA\bin\widgets\\qabstractslider.
cpp:942 org.
netbeans.
modules.
viewmodel.
TreeModelNode@b3751f
[Name
=, displayName
=QSlider::event(this=0xc8c45d8,event
=0x22abfc
) at widgets\\qslider.
cpp:435] C
:\Users\Matt
-usr\Documents\CTA\bin\widgets\\qslider.
cpp:435 org.netbeans.modules.viewmodel.TreeModelNode@1ce51dd[Name=, displayName=QApplicationPrivate::notify_helper(this=0x3f3a78,receiver=0xc8c45d8,e=0x22abfc) at kernel\\qapplication.cpp:4462] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication.cpp:4462
org.
netbeans.
modules.
viewmodel.
TreeModelNode@60b54e
[Name
=, displayName
=QApplication::notify(this=0x22ff20,receiver
=0xc8c45d8,e
=0x22abfc
) at kernel\\qapplication.
cpp:4023] C
:\Users\Matt
-usr\Documents\CTA\bin\kernel\\qapplication.
cpp:4023 org.
netbeans.
modules.
viewmodel.
TreeModelNode@11f4657
[Name
=, displayName
=QCoreApplication::notifyInternal(this=0x22ff20,receiver
=0xc8c45d8,event
=0x22abfc
) at kernel\\qcoreapplication.
cpp:731] C
:\Users\Matt
-usr\Documents\CTA\bin\kernel\\qcoreapplication.
cpp:731 org.
netbeans.
modules.
viewmodel.
TreeModelNode@
431814[Name
=, displayName
=QCoreApplication::sendSpontaneousEvent(receiver
=0xc8c45d8,event
=0x22abfc
) at ..
/..
/include
/QtCore
/..
/..
/src
/corelib
/kernel
/qcoreapplication.
h:218] C
:\Users\Matt
-usr\Documents\CTA\bin\..\..\include\QtCore\..\..\src\corelib\kernel\qcoreapplication.
h:218 org.netbeans.modules.viewmodel.TreeModelNode@e1ca35[Name=, displayName=QApplicationPrivate::sendMouseEvent(receiver=0xc8c45d8,event=0x22abfc,alienWidget=0xc8c45d8,nativeWidget=0x22feb0,buttonDown=0x15db41c,lastMouseReceiver=@0x15db420: {o = 0xc8c45d8},spontaneous=true)
at kernel\\qapplication.cpp:3120] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication.cpp:3120
org.netbeans.modules.viewmodel.TreeModelNode@1a25f0d[Name=, displayName=QETWidget::translateMouseEvent(this=0x22feb0,msg=@0x22b0f8: {hwnd = 0x150374, message = 512, wParam = 1, lParam = 2163086, time = 2273640, pt = {x = 398, y = 55}})
at kernel\\qapplication_win.cpp:3321] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication_win.cpp:3321
org.netbeans.modules.viewmodel.TreeModelNode@10e69fd[Name=, displayName=QtWndProc@16(hwnd=0x150374,message=512,wParam=1,lParam=2163086) at kernel\\qapplication_win.cpp:1659] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication_win.cpp:1659
org.netbeans.modules.viewmodel.TreeModelNode@1507d48[Name=, displayName=USER32!IsWindowVisible()] C:\\Windows\\system32\\user32.dll
org.netbeans.modules.viewmodel.TreeModelNode@1510be0[Name=, displayName=Address: [@0x00150374]]
org.netbeans.modules.viewmodel.TreeModelNode@1e2a3e7[Name=, displayName=Address: [@0x00000200]]
org.netbeans.modules.viewmodel.TreeModelNode@76a726[Name=, displayName=USER32!IsWindowVisible()] C:\\Windows\\system32\\user32.dll
org.netbeans.modules.viewmodel.TreeModelNode@1d7b83b[Name=, displayName=qt_is_translatable_mouse_event(message=0) at kernel\\qapplication_win.cpp:1426] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication_win.cpp:1426
org.netbeans.modules.viewmodel.TreeModelNode@180599e[Name=, displayName=USER32!IsWindowVisible()] C:\\Windows\\system32\\user32.dll
org.netbeans.modules.viewmodel.TreeModelNode@17bd470[Name=, displayName=Address: [@0x00000000]]
org.netbeans.modules.viewmodel.TreeModelNode@e3eed5[Name=, displayName=SelectSource::updateFocusLabel(this=0xc8730e8) at selectsource.cpp:202] C:\\Users\\Matt-usr\\Documents\\CTA\\ProjectFiles\\QtIRView\selectsource.cpp:202
org.netbeans.modules.viewmodel.TreeModelNode@550a69[Name=, displayName=SelectSource::qt_metacall(this=0xc8730e8,_c=QMetaObject::InvokeMetaMethod,_id=11,_a=0x22a408) at moc.tmp/moc_selectsource.cpp:107] C:\\Users\\Matt-usr\\Documents\\CTA\\ProjectFiles\\QtIRView\moc.tmp\moc_selectsource.cpp:107
org.netbeans.modules.viewmodel.TreeModelNode@11e9fc6[Name=, displayName=QMetaObject::metacall(object=0xc8730e8,cl=QMetaObject::InvokeMetaMethod,idx=38,argv=0x22a408) at kernel\\qmetaobject.cpp:237] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qmetaobject.cpp:237
org.netbeans.modules.viewmodel.TreeModelNode@18bb614[Name=, displayName=QMetaObject::activate(sender=0xc8c45d8,m=0x13dedc0,local_signal_index=0,argv=0x22a408) at kernel\\qobject.cpp:3278] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qobject.cpp:3278
org.netbeans.modules.viewmodel.TreeModelNode@15f08f9[Name=, displayName=QAbstractSlider::valueChanged(this=0xc8c45d8,_t1=888) at tmp\\moc\\debug_shared\\moc_qabstractslider.cpp:182] C:\Users\Matt-usr\Documents\CTA\bin\tmp\\moc\\debug_shared\\moc_qabstractslider.cpp:182
org.netbeans.modules.viewmodel.TreeModelNode@464666[Name=, displayName=QAbstractSlider::setValue(this=0xc8c45d8,value=888) at widgets\\qabstractslider.cpp:543] C:\Users\Matt-usr\Documents\CTA\bin\widgets\\qabstractslider.cpp:543
org.netbeans.modules.viewmodel.TreeModelNode@1b80e2d[Name=, displayName=QAbstractSlider::triggerAction(this=0xc8c45d8,action=QAbstractSlider::SliderMove) at widgets\\qabstractslider.cpp:632] C:\Users\Matt-usr\Documents\CTA\bin\widgets\\qabstractslider.cpp:632
org.netbeans.modules.viewmodel.TreeModelNode@aac5db[Name=, displayName=QAbstractSlider::setSliderPosition(this=0xc8c45d8,position=888) at widgets\\qabstractslider.cpp:500] C:\Users\Matt-usr\Documents\CTA\bin\widgets\\qabstractslider.cpp:500
org.netbeans.modules.viewmodel.TreeModelNode@1a3c2bf[Name=, displayName=QSlider::mouseMoveEvent(this=0xc8c45d8,ev=0x22abfc) at widgets\\qslider.cpp:514] C:\Users\Matt-usr\Documents\CTA\bin\widgets\\qslider.cpp:514
org.netbeans.modules.viewmodel.TreeModelNode@46a30e[Name=, displayName=QWidget::event(this=0xc8c45d8,event=0x22abfc) at kernel\\qwidget.cpp:8244] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qwidget.cpp:8244
org.netbeans.modules.viewmodel.TreeModelNode@17b28cc[Name=, displayName=QAbstractSlider::event(this=0xc8c45d8,e=0x22abfc) at widgets\\qabstractslider.cpp:942] C:\Users\Matt-usr\Documents\CTA\bin\widgets\\qabstractslider.cpp:942
org.netbeans.modules.viewmodel.TreeModelNode@b3751f[Name=, displayName=QSlider::event(this=0xc8c45d8,event=0x22abfc) at widgets\\qslider.cpp:435] C:\Users\Matt-usr\Documents\CTA\bin\widgets\\qslider.cpp:435
org.netbeans.modules.viewmodel.TreeModelNode@1ce51dd[Name=, displayName=QApplicationPrivate::notify_helper(this=0x3f3a78,receiver=0xc8c45d8,e=0x22abfc) at kernel\\qapplication.cpp:4462] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication.cpp:4462
org.netbeans.modules.viewmodel.TreeModelNode@60b54e[Name=, displayName=QApplication::notify(this=0x22ff20,receiver=0xc8c45d8,e=0x22abfc) at kernel\\qapplication.cpp:4023] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication.cpp:4023
org.netbeans.modules.viewmodel.TreeModelNode@11f4657[Name=, displayName=QCoreApplication::notifyInternal(this=0x22ff20,receiver=0xc8c45d8,event=0x22abfc) at kernel\\qcoreapplication.cpp:731] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qcoreapplication.cpp:731
org.netbeans.modules.viewmodel.TreeModelNode@431814[Name=, displayName=QCoreApplication::sendSpontaneousEvent(receiver=0xc8c45d8,event=0x22abfc) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218] C:\Users\Matt-usr\Documents\CTA\bin\..\..\include\QtCore\..\..\src\corelib\kernel\qcoreapplication.h:218
org.netbeans.modules.viewmodel.TreeModelNode@e1ca35[Name=, displayName=QApplicationPrivate::sendMouseEvent(receiver=0xc8c45d8,event=0x22abfc,alienWidget=0xc8c45d8,nativeWidget=0x22feb0,buttonDown=0x15db41c,lastMouseReceiver=@0x15db420: {o = 0xc8c45d8},spontaneous=true)
at kernel\\qapplication.cpp:3120] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication.cpp:3120
org.netbeans.modules.viewmodel.TreeModelNode@1a25f0d[Name=, displayName=QETWidget::translateMouseEvent(this=0x22feb0,msg=@0x22b0f8: {hwnd = 0x150374, message = 512, wParam = 1, lParam = 2163086, time = 2273640, pt = {x = 398, y = 55}})
at kernel\\qapplication_win.cpp:3321] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication_win.cpp:3321
org.netbeans.modules.viewmodel.TreeModelNode@10e69fd[Name=, displayName=QtWndProc@16(hwnd=0x150374,message=512,wParam=1,lParam=2163086) at kernel\\qapplication_win.cpp:1659] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication_win.cpp:1659
org.netbeans.modules.viewmodel.TreeModelNode@1507d48[Name=, displayName=USER32!IsWindowVisible()] C:\\Windows\\system32\\user32.dll
org.netbeans.modules.viewmodel.TreeModelNode@1510be0[Name=, displayName=Address: [@0x00150374]]
org.netbeans.modules.viewmodel.TreeModelNode@1e2a3e7[Name=, displayName=Address: [@0x00000200]]
org.netbeans.modules.viewmodel.TreeModelNode@76a726[Name=, displayName=USER32!IsWindowVisible()] C:\\Windows\\system32\\user32.dll
org.netbeans.modules.viewmodel.TreeModelNode@1d7b83b[Name=, displayName=qt_is_translatable_mouse_event(message=0) at kernel\\qapplication_win.cpp:1426] C:\Users\Matt-usr\Documents\CTA\bin\kernel\\qapplication_win.cpp:1426
org.netbeans.modules.viewmodel.TreeModelNode@180599e[Name=, displayName=USER32!IsWindowVisible()] C:\\Windows\\system32\\user32.dll
org.netbeans.modules.viewmodel.TreeModelNode@17bd470[Name=, displayName=Address: [@0x00000000]]
To copy to clipboard, switch view to plain text mode
SelectSource
::SelectSource(QWidget *parent
){
...
getRingElement = new GetRingElement(); // must not have a parent as this would prevent moveToThread() working
connect(getRingElement,
SIGNAL(msg4console
(QString)), globalConsole,
SLOT(sendMsg
(QString)));
connect(this, SIGNAL(updateACQThreadRE(bool, int, int, int)), getRingElement, SLOT(setRE(bool, int, int, int)));
connect(this, SIGNAL(startACQThreadTimer(int)), getRingElement, SLOT(start(int)));
connect(this, SIGNAL(stopACQThreadTimer()), getRingElement, SLOT(stop()));
getRingElement->moveToThread(thread); // hmm well maybe I should connect only after the code is moved to a separated thread to ensure the queued mode is activated. I could also simply give the queued mode explicitly.
thread->start();
...
}
SelectSource::SelectSource(QWidget *parent)
: QWidget(parent)
{
...
QThread *thread = new QThread;
getRingElement = new GetRingElement(); // must not have a parent as this would prevent moveToThread() working
connect(getRingElement, SIGNAL(msg4console(QString)), globalConsole, SLOT(sendMsg(QString)));
connect(this, SIGNAL(updateACQThreadRE(bool, int, int, int)), getRingElement, SLOT(setRE(bool, int, int, int)));
connect(this, SIGNAL(startACQThreadTimer(int)), getRingElement, SLOT(start(int)));
connect(this, SIGNAL(stopACQThreadTimer()), getRingElement, SLOT(stop()));
getRingElement->moveToThread(thread); // hmm well maybe I should connect only after the code is moved to a separated thread to ensure the queued mode is activated. I could also simply give the queued mode explicitly.
thread->start();
...
}
To copy to clipboard, switch view to plain text mode
in a .h:
extern int (_stdcall * vc_operate_command)(int Handle,char * Command,char * Answer,const int TimeOut);
in a .cpp:
int (_stdcall * vc_operate_command)(int Handle,char * Command,char * Answer,const int TimeOut)=NULL;
in another .cpp:
vc_operate_command = (int (_stdcall *)(int, char *, char *, const int))GetProcAddress(hInstance,"vc_operate_command");
Now when used, the command is called as:
result = vc_operate_command(Vcam->Handle, (char*)(command.toAscii()).constData(), answer, TIMEOUT_ANS);
in a .h:
extern int (_stdcall * vc_operate_command)(int Handle,char * Command,char * Answer,const int TimeOut);
in a .cpp:
int (_stdcall * vc_operate_command)(int Handle,char * Command,char * Answer,const int TimeOut)=NULL;
in another .cpp:
vc_operate_command = (int (_stdcall *)(int, char *, char *, const int))GetProcAddress(hInstance,"vc_operate_command");
Now when used, the command is called as:
result = vc_operate_command(Vcam->Handle, (char*)(command.toAscii()).constData(), answer, TIMEOUT_ANS);
To copy to clipboard, switch view to plain text mode
Bookmarks