Core: Fix exit strategy
Core: Fix exit strategy

Fix break condition for a while loop and add some "const".

Change-Id: I62abe4701d6d919428266772867f4bc6c7c43759
Reviewed-by: Eike Ziller <c142da16c73a95a82d35191bcc55b22835617128@digia.com>

AltarBeastiful/qt-creator,kuba1/qtcreator,amyvmiwei/qt-creator,colede/qtcreator,omniacreator/qtcreator,farseerri/git_code,kuba1/qtcreator,farseerri/git_code,maui-packages/qt-creator,darksylinc/qt-creator,farseerri/git_code,kuba1/qtcreator,darksylinc/qt-creator,danimo/qt-creator,danimo/qt-creator,amyvmiwei/qt-creator,maui-packages/qt-creator,colede/qtcreator,farseerri/git_code,martyone/sailfish-qtcreator,AltarBeastiful/qt-creator,danimo/qt-creator,xianian/qt-creator,danimo/qt-creator,maui-packages/qt-creator,farseerri/git_code,omniacreator/qtcreator,Distrotech/qtcreator,Distrotech/qtcreator,Distrotech/qtcreator,omniacreator/qtcreator,Distrotech/qtcreator,AltarBeastiful/qt-creator,martyone/sailfish-qtcreator,kuba1/qtcreator,Distrotech/qtcreator,Distrotech/qtcreator,danimo/qt-creator,Distrotech/qtcreator,colede/qtcreator,AltarBeastiful/qt-creator,kuba1/qtcreator,colede/qtcreator,xianian/qt-creator,darksylinc/qt-creator,darksylinc/qt-creator,AltarBeastiful/qt-creator,martyone/sailfish-qtcreator,maui-packages/qt-creator,kuba1/qtcreator,AltarBeastiful/qt-creator,colede/qtcreator,kuba1/qtcreator,omniacreator/qtcreator,farseerri/git_code,darksylinc/qt-creator,darksylinc/qt-creator,amyvmiwei/qt-creator,xianian/qt-creator,xianian/qt-creator,maui-packages/qt-creator,darksylinc/qt-creator,AltarBeastiful/qt-creator,martyone/sailfish-qtcreator,amyvmiwei/qt-creator,danimo/qt-creator,amyvmiwei/qt-creator,maui-packages/qt-creator,danimo/qt-creator,martyone/sailfish-qtcreator,xianian/qt-creator,farseerri/git_code,AltarBeastiful/qt-creator,darksylinc/qt-creator,martyone/sailfish-qtcreator,omniacreator/qtcreator,amyvmiwei/qt-creator,martyone/sailfish-qtcreator,danimo/qt-creator,colede/qtcreator,martyone/sailfish-qtcreator,omniacreator/qtcreator,xianian/qt-creator,amyvmiwei/qt-creator,kuba1/qtcreator,martyone/sailfish-qtcreator,xianian/qt-creator,danimo/qt-creator,xianian/qt-creator,amyvmiwei/qt-creator,omniacreator/qtcreator,kuba1/qtcreator,colede/qtcreator,farseerri/git_code,xianian/qt-creator,maui-packages/qt-creator