Julian Foad <julian.foad_at_wandisco.com> writes:
>> [SVN\subversion\libsvn_auth_kwallet\kwallet.cpp:203]: (style) Variable 'app'
>> is assigned a value that is never used
>> [SVN\subversion\libsvn_auth_kwallet\kwallet.cpp:273]: (style) Variable 'app'
>> is assigned a value that is never used
>
> I don't really understand the code there. It was added in r875811 with
> the log message "Fix segmentation fault with KDE 4.2. [...] Create a
> QCoreApplication instance if it doesn't exist." It looks like it's
> creating an object that has to exist for at least the duration of this
> function's body, and thus this variable 'app' is 'used' in the sense
> that it forces this object to exist; but I don't know if that's entirely
> correct.
>
> It also makes me wonder whether this app object should be kept in a
> 'static' variable so that it continues to exist for the lifetime of the
> 'svn' program execution rather than being created and destroyed each
> time this function is executed.
qApp is a Qt global variable that refers to the unique QApplication
instance within the program. The code allocates a QApplication object,
of type QCoreApplication, to run a Qt event loop if this is not a Qt GUI
program. The object is only created if the event loop is not running, I
don't think the object is ever explicitly destroyed (I suppose code
outside Subversion could delete it vi qApp).
To remove the warning I suppose we could drop the app variable, i.e.
new QCoreApplication(...)
instead of
app = new QCoreApplication(...)
but that might prompt other warnings.
--
Philip
Received on 2011-06-29 18:39:49 CEST