pipacs/o2 — pull request #15 by mandeepsandhu (2013-07-15 12:01:32+00:00)
Title: Twitter Demo: Access tokens NOT comitted on exit

Fixed bug which caused tokens to be NOT comitted on app exit.

Any un-comitted changes are 'synced' when a QSettings object is destroyed. This happens in it's d'tor.

The bug was caused because the Helper class was created on the heap w/o a parent. So on application exit, it's d'tor was not getting called. This in turn prevented the QSettings d'tor from being called and any un-comitted data in QSettings was discarded.

Fix is to create the Helper on the stack for proper cleanup.

Bonus Fix:

The waitForMsg_ variable was not "value initialized". This meant that it had garbage value stored in it. This meant that sometimes, depending on its value, the slot Helper::postStatusUpdate() would get called. Fix was to explicitly initialize the boolean variable.