X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=pirkeysetmetadata.cpp;fp=pirkeysetmetadata.cpp;h=e80822c9f337605c33e0087fe20c2edf46f3910c;hb=f3809ec697222bd9ad47c725bb72dd7272fd594b;hp=903425e03bde00a53cf2969e7222e6e06113f57f;hpb=ca07675aa383be558295fc82411c677bae207257;p=pierogi diff --git a/pirkeysetmetadata.cpp b/pirkeysetmetadata.cpp index 903425e..e80822c 100644 --- a/pirkeysetmetadata.cpp +++ b/pirkeysetmetadata.cpp @@ -11,6 +11,9 @@ extern PIRMakeMgr makeManager; // Static member definition: PIRDeviceCollection PIRKeysetMetaData::controlledDevices; +// Thread synchronization stuff: +extern bool commandInFlight; + PIRKeysetMetaData::PIRKeysetMetaData( const char *r, PIRMakeName m, @@ -25,8 +28,7 @@ PIRKeysetMetaData::PIRKeysetMetaData( PIRKeysetMetaData::~PIRKeysetMetaData() { - if (threadableProtocol) delete threadableProtocol; - threadableProtocol = 0; + clearProtocol(); } @@ -302,11 +304,18 @@ void PIRKeysetMetaData::setKeysetName( } -void PIRKeysetMetaData::clearProtocol() +bool PIRKeysetMetaData::clearProtocol() { - if (threadableProtocol) + if (!threadableProtocol) + { + return true; + } + else if (!commandInFlight) { delete threadableProtocol; threadableProtocol = 0; + return true; } + + return false; }