I recently ran into a thread / memory issue when developing a Qt-based application in C ++, and I'm looking for the right explanation. I cannot post a fully functioning example, as this would require binding to Qt, etc. But the problem is quite clearly explained in a few short lines.
When I press the button on gui, something like this happens:
void MainWindow::onClick(){
std::vector<int> vec;
vec.push_back(0);
dev.connect(vec);
}
In this case, it devis a member MainWindowand has a class type Devicethat represents the hardware (or rather, the hardware drivers) with which I want to establish a connection. The code for connectsomething looks like this:
void Device::connect(const std::vector<int>& vec){
}
, , , , vec. , connect, : vec . , shared_ptr s.
, dev.connect(vec) GUI, Qt . , Qt , onClick ( - , , ), vec Device::connect, . , shared_ptr .
, , ? - Qt- - ?