idevice 1.1.5.1 → 1.1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/idevice/afc.rb CHANGED
@@ -33,7 +33,11 @@ module Idevice
33
33
  include LibHelpers
34
34
 
35
35
  def self.release(ptr)
36
- C.afc_client_free(ptr) unless ptr.null?
36
+ C::Freelock.synchronize do
37
+ unless ptr.null?
38
+ C.afc_client_free(ptr)
39
+ end
40
+ end
37
41
  end
38
42
 
39
43
  def self.attach(opts={})
data/lib/idevice/c.rb CHANGED
@@ -21,6 +21,7 @@
21
21
  require "rubygems"
22
22
  require 'plist'
23
23
  require "ffi"
24
+ require "thread"
24
25
 
25
26
  module FFI
26
27
  class MemoryPointer < Pointer
@@ -102,6 +103,8 @@ module Idevice
102
103
  module C
103
104
  extend FFI::Library
104
105
 
106
+ Freelock = Mutex.new
107
+
105
108
  class ManagedOpaquePointer < FFI::AutoPointer
106
109
  def initialize(pointer)
107
110
  raise NoMethodError, "release() not implemented for class #{self}" unless self.class.respond_to? :release
@@ -43,7 +43,11 @@ module Idevice
43
43
  ]
44
44
 
45
45
  def self.release(ptr)
46
- C.diagnostics_relay_client_free(ptr) unless ptr.null?
46
+ C::Freelock.synchronize do
47
+ unless ptr.null?
48
+ C.diagnostics_relay_client_free(ptr)
49
+ end
50
+ end
47
51
  end
48
52
 
49
53
 
@@ -29,7 +29,11 @@ module Idevice
29
29
  class FileRelayClient < C::ManagedOpaquePointer
30
30
  include LibHelpers
31
31
  def self.release(ptr)
32
- C.file_relay_client_free(ptr) unless ptr.null?
32
+ C::Freelock.synchronize do
33
+ unless ptr.null?
34
+ C.file_relay_client_free(ptr)
35
+ end
36
+ end
33
37
  end
34
38
 
35
39
  def self.attach(opts={})
@@ -31,7 +31,11 @@ module Idevice
31
31
  include LibHelpers
32
32
 
33
33
  def self.release(ptr)
34
- C.heartbeat_client_free(ptr) unless ptr.null?
34
+ C::Freelock.synchronize do
35
+ unless ptr.null?
36
+ C.heartbeat_client_free(ptr)
37
+ end
38
+ end
35
39
  end
36
40
 
37
41
  def self.attach(opts={})
@@ -31,7 +31,11 @@ module Idevice
31
31
  include LibHelpers
32
32
 
33
33
  def self.release(ptr)
34
- C.house_arrest_client_free(ptr) unless ptr.null?
34
+ C::Freelock.synchronize do
35
+ unless ptr.null?
36
+ C.house_arrest_client_free(ptr)
37
+ end
38
+ end
35
39
  end
36
40
 
37
41
  def self.attach(opts={})
@@ -28,7 +28,11 @@ module Idevice
28
28
 
29
29
  class Idevice < C::ManagedOpaquePointer
30
30
  def self.release(ptr)
31
- C.idevice_free(ptr) unless ptr.null?
31
+ C::Freelock.synchronize do
32
+ unless ptr.null?
33
+ C.idevice_free(ptr)
34
+ end
35
+ end
32
36
  end
33
37
 
34
38
  # Use this instead of 'new' to attach to an idevice using libimobiledevice
@@ -33,7 +33,11 @@ module Idevice
33
33
  include LibHelpers
34
34
 
35
35
  def self.release(ptr)
36
- C.mobile_image_mounter_free(ptr) unless ptr.null?
36
+ C::Freelock.synchronize do
37
+ unless ptr.null?
38
+ C.mobile_image_mounter_free(ptr)
39
+ end
40
+ end
37
41
  end
38
42
 
39
43
  def self.attach(opts={})
@@ -31,7 +31,11 @@ module Idevice
31
31
  include LibHelpers
32
32
 
33
33
  def self.release(ptr)
34
- C.instproxy_client_free(ptr) unless ptr.null?
34
+ C::Freelock.synchronize do
35
+ unless ptr.null?
36
+ C.instproxy_client_free(ptr)
37
+ end
38
+ end
35
39
  end
36
40
 
37
41
  def self.attach(opts={})
@@ -121,8 +125,13 @@ module Idevice
121
125
  end
122
126
 
123
127
  private
124
- def _cb
125
- @_cb_procblk = Proc.new {|op, status, junk| yield(op, status.to_ruby) }
128
+ def _cb(&block)
129
+ @_cb_blk = block
130
+ @_cb_procblk = Proc.new do |op, status, junk|
131
+ unless status.null?
132
+ @_cb_blk.call(op, status.to_ruby)
133
+ end
134
+ end
126
135
  return @_cb_procblk
127
136
  end
128
137
  end
@@ -28,8 +28,13 @@ module Idevice
28
28
 
29
29
  # Used to manage device preferences, start services, pairing and activation on the device.
30
30
  class LockdownClient < C::ManagedOpaquePointer
31
+
31
32
  def self.release(ptr)
32
- C.lockdownd_client_free(ptr) unless ptr.null?
33
+ C::Freelock.synchronize do
34
+ unless ptr.null?
35
+ C.lockdownd_client_free(ptr)
36
+ end
37
+ end
33
38
  end
34
39
 
35
40
  def self.attach(opts={})
@@ -32,7 +32,11 @@ module Idevice
32
32
  include LibHelpers
33
33
 
34
34
  def self.release(ptr)
35
- C.misagent_client_free(ptr) unless ptr.null?
35
+ C::Freelock.synchronize do
36
+ unless ptr.null?
37
+ C.misagent_client_free(ptr)
38
+ end
39
+ end
36
40
  end
37
41
 
38
42
  def self.attach(opts={})
@@ -32,7 +32,11 @@ module Idevice
32
32
  include LibHelpers
33
33
 
34
34
  def self.release(ptr)
35
- C.mobilebackup_client_free(ptr) unless ptr.null?
35
+ C::Freelock.synchronize do
36
+ unless ptr.null?
37
+ C.mobilebackup_client_free(ptr)
38
+ end
39
+ end
36
40
  end
37
41
 
38
42
  FLAG_RESTORE_NOTIFY_SPRINGBOARD = (1 << 0)
@@ -32,7 +32,11 @@ module Idevice
32
32
  include LibHelpers
33
33
 
34
34
  def self.release(ptr)
35
- C.mobilebackup2_client_free(ptr) unless ptr.null?
35
+ C::Freelock.synchronize do
36
+ unless ptr.null?
37
+ C.mobilebackup2_client_free(ptr)
38
+ end
39
+ end
36
40
  end
37
41
 
38
42
  def self.attach(opts={})
@@ -33,7 +33,11 @@ module Idevice
33
33
  include LibHelpers
34
34
 
35
35
  def self.release(ptr)
36
- C.mobilesync_client_free(ptr) unless ptr.null?
36
+ C::Freelock.synchronize do
37
+ unless ptr.null?
38
+ C.mobilesync_client_free(ptr)
39
+ end
40
+ end
37
41
  end
38
42
 
39
43
  def self.attach(opts={})
@@ -68,7 +68,11 @@ module Idevice
68
68
  include LibHelpers
69
69
 
70
70
  def self.release(ptr)
71
- C.np_client_free(ptr) unless ptr.null?
71
+ C::Freelock.synchronize do
72
+ unless ptr.null?
73
+ C.np_client_free(ptr)
74
+ end
75
+ end
72
76
  end
73
77
 
74
78
  def self.attach(opts={})
data/lib/idevice/plist.rb CHANGED
@@ -65,7 +65,11 @@ end
65
65
  module Idevice
66
66
  class Plist_t < C::ManagedOpaquePointer
67
67
  def self.release(ptr)
68
- C::plist_free(ptr) unless ptr.null?
68
+ C::Freelock.synchronize do
69
+ unless ptr.null?
70
+ C::plist_free(ptr)
71
+ end
72
+ end
69
73
  end
70
74
 
71
75
  def self.new_array
@@ -30,7 +30,11 @@ module Idevice
30
30
  # Used to initiate the device restore process or reboot a device.
31
31
  class RestoreClient < C::ManagedOpaquePointer
32
32
  def self.release(ptr)
33
- C.restored_client_free(ptr) unless ptr.null?
33
+ C::Freelock.synchronize do
34
+ unless ptr.null?
35
+ C.restored_client_free(ptr)
36
+ end
37
+ end
34
38
  end
35
39
 
36
40
  def self.attach(opts={})
@@ -33,7 +33,11 @@ module Idevice
33
33
  include LibHelpers
34
34
 
35
35
  def self.release(ptr)
36
- C.sbservices_client_free(ptr) unless ptr.null?
36
+ C::Freelock.synchronize do
37
+ unless ptr.null?
38
+ C.sbservices_client_free(ptr)
39
+ end
40
+ end
37
41
  end
38
42
 
39
43
  def self.attach(opts={})
@@ -31,7 +31,11 @@ module Idevice
31
31
  include LibHelpers
32
32
 
33
33
  def self.release(ptr)
34
- C.screenshotr_client_free(ptr) unless ptr.null?
34
+ C::Freelock.synchronize do
35
+ unless ptr.null?
36
+ C.screenshotr_client_free(ptr)
37
+ end
38
+ end
35
39
  end
36
40
 
37
41
  def self.attach(opts={})
@@ -1,3 +1,3 @@
1
1
  module Idevice
2
- VERSION = "1.1.5.1"
2
+ VERSION = "1.1.5.2"
3
3
  end
@@ -31,7 +31,11 @@ module Idevice
31
31
  include LibHelpers
32
32
 
33
33
  def self.release(ptr)
34
- C.webinspector_client_free(ptr) unless ptr.null?
34
+ C::Freelock.synchronize do
35
+ unless ptr.null?
36
+ C.webinspector_client_free(ptr)
37
+ end
38
+ end
35
39
  end
36
40
 
37
41
  def self.attach(opts={})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idevice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5.1
4
+ version: 1.1.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -190,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  segments:
192
192
  - 0
193
- hash: 1179436659693123887
193
+ hash: 2221588870946456770
194
194
  required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  none: false
196
196
  requirements:
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  version: '0'
200
200
  segments:
201
201
  - 0
202
- hash: 1179436659693123887
202
+ hash: 2221588870946456770
203
203
  requirements: []
204
204
  rubyforge_project:
205
205
  rubygems_version: 1.8.25