URI: 
       tMerge branch 'master' of git://github.com/spesmilo/electrum - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit ae425764237d89a5e16db4f984406509f08f2601
   DIR parent 86a0103a7f381ff499ade89e42f86023b6ad7e08
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Thu, 12 Nov 2015 14:32:19 +0100
       
       Merge branch 'master' of git://github.com/spesmilo/electrum
       
       Diffstat:
         M gui/android.py                      |       3 ---
         M gui/qt/main_window.py               |       1 -
         M gui/stdio.py                        |      13 +------------
         M gui/text.py                         |       3 ---
         M lib/network.py                      |      14 ++++++++++----
         M lib/synchronizer.py                 |       5 ++++-
         M lib/wallet.py                       |       7 +++++--
         M plugins/labels.py                   |       3 +++
       
       8 files changed, 23 insertions(+), 26 deletions(-)
       ---
   DIR diff --git a/gui/android.py b/gui/android.py
       t@@ -909,9 +909,6 @@ class ElectrumGui:
                network = _network
                config = _config
                network.register_callback('updated', update_callback)
       -        network.register_callback('connected', update_callback)
       -        network.register_callback('disconnected', update_callback)
       -        network.register_callback('disconnecting', update_callback)
        
                contacts = util.StoreDict(config, 'contacts')
        
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -163,7 +163,6 @@ class ElectrumWindow(QMainWindow, PrintError):
                    self.network.register_callback('updated', lambda: self.need_update.set())
                    self.network.register_callback('new_transaction', self.new_transaction)
                    self.register_callback('status', self.update_status)
       -            self.register_callback('close', self.close)
                    self.register_callback('banner', self.console.showMessage)
                    self.register_callback('verified', self.history_list.update_item)
        
   DIR diff --git a/gui/stdio.py b/gui/stdio.py
       t@@ -35,9 +35,7 @@ class ElectrumGui:
                self.contacts = StoreDict(self.config, 'contacts')
        
                self.wallet.network.register_callback('updated', self.updated)
       -        self.wallet.network.register_callback('connected', self.connected)
       -        self.wallet.network.register_callback('disconnected', self.disconnected)
       -        self.wallet.network.register_callback('disconnecting', self.disconnecting)
       +
                self.wallet.network.register_callback('peers', self.peers)
                self.wallet.network.register_callback('banner', self.print_banner)
                self.commands = [_("[h] - displays this help text"), \
       t@@ -73,15 +71,6 @@ class ElectrumGui:
                for s in l:
                    print (s)
        
       -    def connected(self):
       -        print ("connected")
       -
       -    def disconnected(self):
       -        print ("disconnected")
       -
       -    def disconnecting(self):
       -        print ("disconnecting")
       -
            def updated(self):
                s = self.get_balance()
                if s != self.last_balance:
   DIR diff --git a/gui/text.py b/gui/text.py
       t@@ -54,9 +54,6 @@ class ElectrumGui:
        
                if self.network:
                    self.network.register_callback('updated', self.update)
       -            self.network.register_callback('connected', self.refresh)
       -            self.network.register_callback('disconnected', self.refresh)
       -            self.network.register_callback('disconnecting', self.refresh)
        
                self.tab_names = [_("History"), _("Send"), _("Receive"), _("Addresses"), _("Contacts"), _("Banner")]
                self.num_tabs = len(self.tab_names)
   DIR diff --git a/lib/network.py b/lib/network.py
       t@@ -198,10 +198,10 @@ class Network(util.DaemonThread):
                with self.lock:
                    self.callbacks[event].append(callback)
        
       -    def trigger_callback(self, event, params=()):
       +    def trigger_callback(self, event, *args):
                with self.lock:
                    callbacks = self.callbacks[event][:]
       -        [callback(*params) for callback in callbacks]
       +        [callback(*args) for callback in callbacks]
        
            def read_recent_servers(self):
                if not self.config.path:
       t@@ -294,11 +294,10 @@ class Network(util.DaemonThread):
                return value
        
            def notify(self, key):
       -        value = self.get_status_value(key)
                if key in ['status', 'updated']:
                    self.trigger_callback(key)
                else:
       -            self.trigger_callback(key, (value,))
       +            self.trigger_callback(key, self.get_status_value(key))
        
            def get_parameters(self):
                host, port, protocol = deserialize_server(self.default_server)
       t@@ -556,6 +555,13 @@ class Network(util.DaemonThread):
                        message_id = self.queue_request(method, params)
                        self.unanswered_requests[message_id] = method, params, callback
        
       +    def unsubscribe(self, callback):
       +        '''Unsubscribe a callback to free object references to enable GC.'''
       +        # Note: we can't unsubscribe from the server, so if we receive
       +        # subsequent notifications process_response() will emit a harmless
       +        # "received unexpected notification" warning
       +        self.subscriptions.pop(callback, None)
       +
            def connection_down(self, server):
                '''A connection to server either went down, or was never made.
                We distinguish by whether it is in self.interfaces.'''
   DIR diff --git a/lib/synchronizer.py b/lib/synchronizer.py
       t@@ -56,6 +56,9 @@ class Synchronizer(ThreadJob):
                return (not self.requested_tx and not self.requested_histories
                        and not self.requested_addrs)
        
       +    def release(self):
       +        self.network.unsubscribe(self.addr_subscription_response)
       +
            def add(self, address):
                '''This can be called from the proxy or GUI threads.'''
                with self.lock:
       t@@ -126,7 +129,7 @@ class Synchronizer(ThreadJob):
                self.print_error("received tx %s height: %d bytes: %d" %
                                 (tx_hash, tx_height, len(tx.raw)))
                # callbacks
       -        self.network.trigger_callback('new_transaction', (tx,))
       +        self.network.trigger_callback('new_transaction', tx)
                if not self.requested_tx:
                    self.network.trigger_callback('updated')
        
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -36,6 +36,7 @@ from transaction import Transaction
        from plugins import run_hook
        import bitcoin
        from synchronizer import Synchronizer
       +from verifier import SPV
        from mnemonic import Mnemonic
        
        import paymentrequest
       t@@ -434,7 +435,7 @@ class Abstract_Wallet(PrintError):
                self.storage.put('verified_tx3', self.verified_tx, True)
        
                conf, timestamp = self.get_confirmations(tx_hash)
       -        self.network.trigger_callback('verified', (tx_hash, conf, timestamp))
       +        self.network.trigger_callback('verified', tx_hash, conf, timestamp)
        
            def get_unverified_txs(self):
                '''Returns a map from tx hash to transaction height'''
       t@@ -1131,7 +1132,6 @@ class Abstract_Wallet(PrintError):
                        self.transactions.pop(tx_hash)
        
            def start_threads(self, network):
       -        from verifier import SPV
                self.network = network
                if self.network is not None:
                    self.prepare_for_verifier()
       t@@ -1145,8 +1145,11 @@ class Abstract_Wallet(PrintError):
            def stop_threads(self):
                if self.network:
                    self.network.remove_jobs([self.synchronizer, self.verifier])
       +            self.synchronizer.release()
                    self.synchronizer = None
                    self.verifier = None
       +            # Now no references to the syncronizer or verifier
       +            # remain so they will be GC-ed
                    self.storage.put('stored_height', self.get_local_height(), True)
        
            def wait_until_synchronized(self, callback=None):
   DIR diff --git a/plugins/labels.py b/plugins/labels.py
       t@@ -53,6 +53,9 @@ class Plugin(BasePlugin):
                t.setDaemon(True)
                t.start()
        
       +    def on_close_window(self, window):
       +        self.wallets.pop(window.wallet)
       +
            def version(self):
                return "0.0.1"