~gary-lasker/software-center/replace-restfulclient-with-piston-tweaks

« back to all changes in this revision

Viewing changes to softwarecenter/backend/restfulclient.py

  • Committer: Michael Vogt
  • Date: 2012-01-05 09:53:52 UTC
  • Revision ID: michael.vogt@ubuntu.com-20120105095352-hx7a9zh3s8z2xwn6
test fixes, testsuite passes now *except* that the GObject.thread_init() is needed to use threads but if its used it will causes segfaults on exit

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        authorizer = OAuthAuthorizer(self.token["consumer_key"],
171
171
                                     self.token["consumer_secret"],
172
172
                                     access_token=token)
 
173
        # we need to init the GObject.init_threads()
 
174
        #  - if we do it globally s-c will crash on exit (LP: #907568)
 
175
        #  - if we don't do it, s-c will hang in worker_thread.start()
 
176
        #    (even though threads_init is deprecated and according to the
 
177
        #     docs is run automatically nowdays)
 
178
        #  - if we do it here some apps will still crash
173
179
        self.worker_thread =  RestfulClientWorker(authorizer, self.service)
174
180
        self.worker_thread.start()
175
181
        GObject.timeout_add(200, self._monitor_thread)
191
197
        self._error = e
192
198
 
193
199
    def whoami(self):
 
200
        LOG.debug("whoami called")
194
201
        self.worker_thread.queue_request("accounts.me", (), {},
195
202
                                         self._thread_whoami_done,
196
203
                                         self._thread_whoami_error)