From 31c14150e7e36b219881bb2a87722cbb6bfd078c Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 31 Mar 2013 16:46:51 -0700 Subject: [PATCH] NSM: Fix occasional deadlock of session manager GUI when displaying "Command failed with..." message. Closes #44. --- session-manager/src/session-manager.C | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/session-manager/src/session-manager.C b/session-manager/src/session-manager.C index e4a0061..a123bc4 100644 --- a/session-manager/src/session-manager.C +++ b/session-manager/src/session-manager.C @@ -427,6 +427,17 @@ public: } }; +static +void +fl_awake_alert( void *v ) +{ + if ( v ) + { + fl_alert( (char*)v); + free( v ); + } +} + void browser_callback ( Fl_Widget *w, void * ) { @@ -1016,7 +1027,12 @@ private: int err = argv[1]->i; if ( err != 0 ) - fl_alert( "Command %s failed with:\n\n%s", &argv[0]->s, &argv[2]->s ); + { + char *s; + asprintf( &s, "Command %s failed with:\n\n%s", &argv[0]->s, &argv[2]->s ); + + Fl::awake(fl_awake_alert, s); + } } else if (!strcmp( path, "/reply" ) && argc && 's' == *types ) {