
Originally Posted by
tescrin
EDIT2:
I dabbled with some psuedo-code:
connect(keypadX_option_was_clicked, ready_keypadX())
ready_keypadX(){
transporter* Jason_Statham;
connect(Jason_Statham->isReady(), create_keypadX() // Jason_Statham->isReady() - you just got yourself some 'undefined behaviour'.
emit(I_need_an_update(Jason_Statham)); // what is the receiver of this dangling pointer meant to do with it?
}
create_keypadX(){
//cast sender() as_transporter()
//get data from Jason
}
connect(keypadX_option_was_clicked, ready_keypadX())
ready_keypadX(){
transporter* Jason_Statham;
connect(Jason_Statham->isReady(), create_keypadX() // Jason_Statham->isReady() - you just got yourself some 'undefined behaviour'.
emit(I_need_an_update(Jason_Statham)); // what is the receiver of this dangling pointer meant to do with it?
}
create_keypadX(){
//cast sender() as_transporter()
//get data from Jason
}
To copy to clipboard, switch view to plain text mode
Please correct me if I'm wrong. That said, I'm still curious why this isn't a "multiple slot"-problem still. Jason will have different information at different times if connected to multiple slots. Either way this is a helpful suggestion; I just.. want to be clear about whether the same problem is here or not. It's certainly better than references (we don't allow others to directly manipulate data, we can utilize a mutex, etc..)
comments in code, plus: create_keypadX having to use sender() and cast to transport is very poor design - totally rigid and not encapsulated. Now you can only make a keypad by using a 'transporter'.
connect(keypadX_option_was_clicked, ready_keypadX())
ready_keypadX(){
transporter* Jason_Statham = new transporter;
connect(xxx, isReady(transporter*), this, create_keypadX(transporter*));
emit(I_need_an_update(Jason_Statham)); // what is the receiver of this dangling pointer meant to do with it?
}
create_keypadX(transporter* jason){
// now I have all the data from jason.
}
connect(keypadX_option_was_clicked, ready_keypadX())
ready_keypadX(){
transporter* Jason_Statham = new transporter;
connect(xxx, isReady(transporter*), this, create_keypadX(transporter*));
emit(I_need_an_update(Jason_Statham)); // what is the receiver of this dangling pointer meant to do with it?
}
create_keypadX(transporter* jason){
// now I have all the data from jason.
}
To copy to clipboard, switch view to plain text mode
Bookmarks