Crash due to fatal FSM reentrancy: Closes #6059
A signal was being fired inside an FSM transition handler, a no-no.
This commit is contained in:
parent
afc745cb3f
commit
346a0470ac
2 changed files with 15 additions and 3 deletions
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
public class Geary.Imap.Capabilities : Geary.GenericCapabilities {
|
||||
public const string IDLE = "IDLE";
|
||||
public const string STARTTLS = "STARTTLS";
|
||||
public const string COMPRESS = "COMPRESS";
|
||||
public const string DEFLATE_SETTING = "DEFLATE";
|
||||
|
|
|
|||
|
|
@ -673,11 +673,16 @@ public class Geary.Imap.ClientSession {
|
|||
}
|
||||
|
||||
private uint on_login_failed(uint state, uint event, void *user) {
|
||||
login_failed();
|
||||
// don't fire signals inside state transition handlers
|
||||
fsm.do_post_transition(on_signal_login_failed);
|
||||
|
||||
return State.NOAUTH;
|
||||
}
|
||||
|
||||
private void on_signal_login_failed() {
|
||||
login_failed();
|
||||
}
|
||||
|
||||
//
|
||||
// keepalives (nop idling to keep the session alive and to periodically receive notifications
|
||||
// of changes)
|
||||
|
|
@ -813,7 +818,7 @@ public class Geary.Imap.ClientSession {
|
|||
}
|
||||
|
||||
public bool supports_idle() {
|
||||
return get_capabilities().has_capability("idle");
|
||||
return get_capabilities().has_capability(Capabilities.IDLE);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1128,7 +1133,9 @@ public class Geary.Imap.ClientSession {
|
|||
}
|
||||
|
||||
private uint on_disconnected(uint state, uint event) {
|
||||
drop_connection();
|
||||
// don't do inside signal handler -- although today drop_connection() doesn't fire signals or call
|
||||
// callbacks, it could in the future
|
||||
fsm.do_post_transition(on_drop_connection);
|
||||
|
||||
// although we could go to the DISCONNECTED state, that implies the object can be reused ...
|
||||
// while possible, that requires all state (not just the FSM) be reset at this point, and
|
||||
|
|
@ -1138,6 +1145,10 @@ public class Geary.Imap.ClientSession {
|
|||
return State.BROKEN;
|
||||
}
|
||||
|
||||
private void on_drop_connection() {
|
||||
drop_connection();
|
||||
}
|
||||
|
||||
//
|
||||
// error handling
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue