0

I have a QT4 application which wraps libssh2 in order to communicate with the embedded devices on the network. The following snippet is making me crazy for a while.

SSHClient ssh_client(host, 22);

try {
    ssh_client.connect_to_host(USERNAME, PASSWORD);
    ssh_client.receive_file(file_name, file_path);
} catch(const SSHException &excp) {
    qDebug() << "test";
    emit console(excp.what());
    return;
}

I put breakpoints to qDebug() << "test"; and emit console(excp.what()); in debugger, however, they never get hit even though an SSHException is thrown. If i put a breakpoint to the return; statement, it stops with no problem.

The output is also strange. qDebug() << "test" does what it is supposed to do, but, emit console(excp.what()); is not emitting a signal. And when the control reaches to the return; statement, it returns, again with no problem.

nobody
  • 19,814
  • 17
  • 56
  • 77
Murat Şeker
  • 1,651
  • 1
  • 16
  • 29
  • Did you build your code with some optimization level? – László Papp May 15 '14 at 21:40
  • Which data type is excp.what() ? You might need to register it with the Qt MetaType system. Have a look at [QMetaType class](http://qt-project.org/doc/qt-4.8/qmetatype.html#details) for details. Also, why do you say the signal is not emitted? (I'll state the obviuos) Have you connnected it with some slot? – sergico May 15 '14 at 21:45
  • @sergico: No, you do not have to register. Perhaps you can start reading about qmetatype first from the link you pasted so that to understand what it is good for? :) Also, the OP said the signal is not emitted because it does not stop there. – László Papp May 15 '14 at 22:04
  • Will need more code ? Atlease your connection statement ! most probably you are connecting signal slot in wrong way. – Abhishek Bansal May 16 '14 at 14:49

0 Answers0