You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/09/28 15:07:23 UTC

svn commit: r1002151 - in /subversion/trunk/subversion: libsvn_auth_kwallet/kwallet.cpp svn/main.c svnsync/main.c

Author: stsp
Date: Tue Sep 28 13:07:23 2010
New Revision: 1002151

URL: http://svn.apache.org/viewvc?rev=1002151&view=rev
Log:
Remove some goo introduced in r878078 and follow-ups, which was related to
the Linux-specific code which has been removed in r1002144.

* subversion/libsvn_auth_kwallet/kwallet.cpp
  (): Remove unneeded #includes.
  (INITIALIZE_APPLICATION): Remove.
  (get_wallet): Remove POOL parameter.
  (kwallet_terminate, kwallet_password_get, kwallet_password_set): Adjust
   users of get_wallet and INITIALIZE_APPLICATION as appropriate.

* subversion/svnsync/main.c,
  subversion/svn/main.c
  (main): Don't bother setting the "qapplication-safe" parameter for
   the Kwallet code, it's not needed anymore.

Modified:
    subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp
    subversion/trunk/subversion/svn/main.c
    subversion/trunk/subversion/svnsync/main.c

Modified: subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp?rev=1002151&r1=1002150&r2=1002151&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp (original)
+++ subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp Tue Sep 28 13:07:23 2010
@@ -47,20 +47,13 @@
 
 #include <dbus/dbus.h>
 #include <QtCore/QCoreApplication>
-#include <QtCore/QList>
-#include <QtCore/QMap>
 #include <QtCore/QString>
-#include <QtGui/QApplication>
-#include <QtGui/QX11Info>
 
 #include <kaboutdata.h>
 #include <kcmdlineargs.h>
 #include <kcomponentdata.h>
 #include <klocalizedstring.h>
 #include <kwallet.h>
-#include <kwindowsystem.h>
-#include <netwm.h>
-#include <netwm_def.h>
 
 
 /*-----------------------------------------------------------------------*/
@@ -68,28 +61,6 @@
 /*-----------------------------------------------------------------------*/
 
 
-#define INITIALIZE_APPLICATION                                            \
-  if (apr_hash_get(parameters,                                            \
-                   "svn:auth:qapplication-safe",                          \
-                   APR_HASH_KEY_STRING))                                  \
-    {                                                                     \
-      QApplication *app;                                                  \
-      if (! qApp)                                                         \
-        {                                                                 \
-          int argc = 1;                                                   \
-          app = new QApplication(argc, (char *[1]) {(char *) "svn"});     \
-        }                                                                 \
-    }                                                                     \
-  else                                                                    \
-    {                                                                     \
-      QCoreApplication *app;                                              \
-      if (! qApp)                                                         \
-        {                                                                 \
-          int argc = 1;                                                   \
-          app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"}); \
-        }                                                                 \
-    }
-
 static const char *
 get_application_name(apr_hash_t *parameters,
                      apr_pool_t *pool)
@@ -162,8 +133,7 @@ get_wid(void)
 
 static KWallet::Wallet *
 get_wallet(QString wallet_name,
-           apr_hash_t *parameters,
-           apr_pool_t *pool)
+           apr_hash_t *parameters)
 {
   KWallet::Wallet *wallet =
     static_cast<KWallet::Wallet *> (apr_hash_get(parameters,
@@ -199,7 +169,7 @@ kwallet_terminate(void *data)
   apr_hash_t *parameters = static_cast<apr_hash_t *> (data);
   if (apr_hash_get(parameters, "kwallet-initialized", APR_HASH_KEY_STRING))
     {
-      KWallet::Wallet *wallet = get_wallet(NULL, parameters, NULL);
+      KWallet::Wallet *wallet = get_wallet(NULL, parameters);
       delete wallet;
       apr_hash_set(parameters,
                    "kwallet-initialized",
@@ -230,7 +200,12 @@ kwallet_password_get(const char **passwo
       return FALSE;
     }
 
-  INITIALIZE_APPLICATION
+  QCoreApplication *app;
+  if (! qApp)
+    {
+      int argc = 1;
+      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
+    }
 
   KCmdLineArgs::init(1,
                      (char *[1]) {(char *) "svn"},
@@ -248,7 +223,7 @@ kwallet_password_get(const char **passwo
     QString::fromUtf8(username) + "@" + QString::fromUtf8(realmstring);
   if (! KWallet::Wallet::keyDoesNotExist(wallet_name, folder, key))
     {
-      KWallet::Wallet *wallet = get_wallet(wallet_name, parameters, pool);
+      KWallet::Wallet *wallet = get_wallet(wallet_name, parameters);
       if (wallet)
         {
           apr_hash_set(parameters,
@@ -295,7 +270,12 @@ kwallet_password_set(apr_hash_t *creds,
       return FALSE;
     }
 
-  INITIALIZE_APPLICATION
+  QCoreApplication *app;
+  if (! qApp)
+    {
+      int argc = 1;
+      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
+    }
 
   KCmdLineArgs::init(1,
                      (char *[1]) {(char *) "svn"},
@@ -310,7 +290,7 @@ kwallet_password_set(apr_hash_t *creds,
   QString q_password = QString::fromUtf8(password);
   QString wallet_name = get_wallet_name(parameters);
   QString folder = QString::fromUtf8("Subversion");
-  KWallet::Wallet *wallet = get_wallet(wallet_name, parameters, pool);
+  KWallet::Wallet *wallet = get_wallet(wallet_name, parameters);
   if (wallet)
     {
       apr_hash_set(parameters,

Modified: subversion/trunk/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/main.c?rev=1002151&r1=1002150&r2=1002151&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/main.c (original)
+++ subversion/trunk/subversion/svn/main.c Tue Sep 28 13:07:23 2010
@@ -2308,9 +2308,6 @@ main(int argc, const char *argv[])
                                            pool)))
     svn_handle_error2(err, stderr, TRUE, "svn: ");
 
-  /* svn can safely create instance of QApplication class. */
-  svn_auth_set_parameter(ab, "svn:auth:qapplication-safe", "1");
-
   ctx->auth_baton = ab;
 
   /* Set up conflict resolution callback. */

Modified: subversion/trunk/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnsync/main.c?rev=1002151&r1=1002150&r2=1002151&view=diff
==============================================================================
--- subversion/trunk/subversion/svnsync/main.c (original)
+++ subversion/trunk/subversion/svnsync/main.c Tue Sep 28 13:07:23 2010
@@ -2149,15 +2149,7 @@ main(int argc, const char *argv[])
                                         check_cancel, NULL,
                                         pool);
   if (! err)
-    {
-      /* svnsync can safely create instance of QApplication class. */
-      svn_auth_set_parameter(opt_baton.source_auth_baton,
-                             "svn:auth:qapplication-safe", "1");
-      svn_auth_set_parameter(opt_baton.sync_auth_baton,
-                             "svn:auth:qapplication-safe", "1");
-
-      err = (*subcommand->cmd_func)(os, &opt_baton, pool);
-    }
+    err = (*subcommand->cmd_func)(os, &opt_baton, pool);
   if (err)
     {
       /* For argument-related problems, suggest using the 'help'



Re: svn commit: r1002151 - in /subversion/trunk/subversion: libsvn_auth_kwallet/kwallet.cpp svn/main.c svnsync/main.c

Posted by Blair Zajac <bl...@orcaware.com>.
On 10/3/10 2:45 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> 2010-09-29 14:29:26 Stefan Sperling napisał(a):
>> On Tue, Sep 28, 2010 at 11:21:26AM -0700, Blair Zajac wrote:
>>> On 9/28/2010 6:07 AM, stsp@apache.org wrote:
>>>> Author: stsp
>>>> Date: Tue Sep 28 13:07:23 2010
>>>> New Revision: 1002151
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1002151&view=rev
>>>> Log:
>>>> Remove some goo introduced in r878078 and follow-ups, which was related to
>>>> the Linux-specific code which has been removed in r1002144.
>>>
>>>> -  INITIALIZE_APPLICATION
>>>> +  QCoreApplication *app;
>>>> +  if (! qApp)
>>>> +    {
>>>> +      int argc = 1;
>>>> +      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
>>>> +    }
>>>
>>> Out of curiosity, what does this do?
>>
>> No idea. I didn't understand this either.
>> I moved this code back out of the INITIALIZE_APPLICATION macro anyway.
>> The code was this way before the INITIALIZE_APPLICATION macro was
>> introduced.
>>
>>> QCoreApplication *app isn't static, so does this do some setup logic
>>> that we don't need to keep track of?
>>
>> That's what it looks like to me, too.
>> I suppose Arfrever will definitely know what this is doing.
>
> This code initializes application to avoid segmentation fault.

Should it initialize the application everytime through the function, since app 
is not static, it won't store the result of the new QCoreApplication?

Blair

Re: svn commit: r1002151 - in /subversion/trunk/subversion: libsvn_auth_kwallet/kwallet.cpp svn/main.c svnsync/main.c

Posted by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com>.
2010-09-29 14:29:26 Stefan Sperling napisał(a):
> On Tue, Sep 28, 2010 at 11:21:26AM -0700, Blair Zajac wrote:
> > On 9/28/2010 6:07 AM, stsp@apache.org wrote:
> > >Author: stsp
> > >Date: Tue Sep 28 13:07:23 2010
> > >New Revision: 1002151
> > >
> > >URL: http://svn.apache.org/viewvc?rev=1002151&view=rev
> > >Log:
> > >Remove some goo introduced in r878078 and follow-ups, which was related to
> > >the Linux-specific code which has been removed in r1002144.
> > 
> > >-  INITIALIZE_APPLICATION
> > >+  QCoreApplication *app;
> > >+  if (! qApp)
> > >+    {
> > >+      int argc = 1;
> > >+      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
> > >+    }
> > 
> > Out of curiosity, what does this do?
> 
> No idea. I didn't understand this either.
> I moved this code back out of the INITIALIZE_APPLICATION macro anyway.
> The code was this way before the INITIALIZE_APPLICATION macro was
> introduced.
> 
> > QCoreApplication *app isn't static, so does this do some setup logic
> > that we don't need to keep track of?
> 
> That's what it looks like to me, too.
> I suppose Arfrever will definitely know what this is doing.

This code initializes application to avoid segmentation fault.

-- 
Arfrever Frehtes Taifersar Arahesis

Re: svn commit: r1002151 - in /subversion/trunk/subversion: libsvn_auth_kwallet/kwallet.cpp svn/main.c svnsync/main.c

Posted by Stefan Sperling <st...@elego.de>.
On Tue, Sep 28, 2010 at 11:21:26AM -0700, Blair Zajac wrote:
> On 9/28/2010 6:07 AM, stsp@apache.org wrote:
> >Author: stsp
> >Date: Tue Sep 28 13:07:23 2010
> >New Revision: 1002151
> >
> >URL: http://svn.apache.org/viewvc?rev=1002151&view=rev
> >Log:
> >Remove some goo introduced in r878078 and follow-ups, which was related to
> >the Linux-specific code which has been removed in r1002144.
> 
> >-  INITIALIZE_APPLICATION
> >+  QCoreApplication *app;
> >+  if (! qApp)
> >+    {
> >+      int argc = 1;
> >+      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
> >+    }
> 
> Out of curiosity, what does this do?

No idea. I didn't understand this either.
I moved this code back out of the INITIALIZE_APPLICATION macro anyway.
The code was this way before the INITIALIZE_APPLICATION macro was
introduced.

> QCoreApplication *app isn't static, so does this do some setup logic
> that we don't need to keep track of?

That's what it looks like to me, too.
I suppose Arfrever will definitely know what this is doing.

Stefan

Re: svn commit: r1002151 - in /subversion/trunk/subversion: libsvn_auth_kwallet/kwallet.cpp svn/main.c svnsync/main.c

Posted by Blair Zajac <bl...@orcaware.com>.
On 9/28/2010 6:07 AM, stsp@apache.org wrote:
> Author: stsp
> Date: Tue Sep 28 13:07:23 2010
> New Revision: 1002151
>
> URL: http://svn.apache.org/viewvc?rev=1002151&view=rev
> Log:
> Remove some goo introduced in r878078 and follow-ups, which was related to
> the Linux-specific code which has been removed in r1002144.

> -  INITIALIZE_APPLICATION
> +  QCoreApplication *app;
> +  if (! qApp)
> +    {
> +      int argc = 1;
> +      app = new QCoreApplication(argc, (char *[1]) {(char *) "svn"});
> +    }

Out of curiosity, what does this do?

QCoreApplication *app isn't static, so does this do some setup logic 
that we don't need to keep track of?

Blair