mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Advanced memory leak fixes
This commit is contained in:
parent
d507574ac2
commit
859ad32e44
10 changed files with 56 additions and 48 deletions
|
|
@ -2,19 +2,19 @@
|
|||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">11E53</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.47</string>
|
||||
<string key="IBDocument.HIToolboxVersion">569.00</string>
|
||||
<string key="IBDocument.SystemVersion">11D50</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.32</string>
|
||||
<string key="IBDocument.HIToolboxVersion">568.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1498</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIWindow</string>
|
||||
<string>IBUICustomObject</string>
|
||||
<string>IBUIViewController</string>
|
||||
<string>IBUIWindow</string>
|
||||
<string>IBProxyObject</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
|
|
@ -83,14 +83,6 @@
|
|||
</object>
|
||||
<int key="connectionID">10</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">window</string>
|
||||
<reference key="source" ref="465836664"/>
|
||||
<reference key="destination" ref="380026005"/>
|
||||
</object>
|
||||
<int key="connectionID">12</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
|
|
@ -104,6 +96,7 @@
|
|||
<int key="objectID">2</int>
|
||||
<reference key="object" ref="380026005"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">LinphoneWindow</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
|
|
@ -154,17 +147,6 @@
|
|||
<object class="IBPartialClassDescription">
|
||||
<string key="className">LinphoneAppDelegate</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">window</string>
|
||||
<string key="NS.object.0">UIWindow</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">window</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">window</string>
|
||||
<string key="candidateClassName">UIWindow</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/LinphoneAppDelegate.h</string>
|
||||
|
|
@ -256,6 +238,6 @@
|
|||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">1498</string>
|
||||
<string key="IBCocoaTouchPluginVersion">1181</string>
|
||||
</data>
|
||||
</archive>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
BOOL started;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIWindow *window;
|
||||
@property (assign) BOOL started;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ int __aeabi_idiv(int a, int b) {
|
|||
|
||||
@implementation LinphoneAppDelegate
|
||||
|
||||
@synthesize window;
|
||||
@synthesize started;
|
||||
|
||||
|
||||
|
|
@ -58,7 +57,6 @@ int __aeabi_idiv(int a, int b) {
|
|||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[window release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +83,7 @@ int __aeabi_idiv(int a, int b) {
|
|||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
if(![LinphoneManager isLcReady]) return;
|
||||
LinphoneCore* lc = [LinphoneManager getLc];
|
||||
LinphoneCall* call = linphone_core_get_current_call(lc);
|
||||
if (call == NULL)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,10 @@ typedef struct _LinphoneCallAppData {
|
|||
@public
|
||||
CallContext currentCallContextBeforeGoingBackground;
|
||||
}
|
||||
+ (LinphoneManager*) instance;
|
||||
+ (LinphoneManager*)instance;
|
||||
#ifdef DEBUG
|
||||
+ (void)instanceRelease;
|
||||
#endif
|
||||
+ (LinphoneCore*) getLc;
|
||||
+ (BOOL)isLcReady;
|
||||
+ (BOOL)runningOnIpad;
|
||||
|
|
@ -89,7 +92,7 @@ typedef struct _LinphoneCallAppData {
|
|||
- (BOOL)resignActive;
|
||||
- (void)becomeActive;
|
||||
|
||||
- (void)kickOffNetworkConnection;
|
||||
+ (void)kickOffNetworkConnection;
|
||||
- (void)setupNetworkReachabilityCallback;
|
||||
|
||||
- (void)refreshRegisters;
|
||||
|
|
|
|||
|
|
@ -155,6 +155,14 @@ struct codec_name_pref_table codec_pref_table[]={
|
|||
return theLinphoneManager;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
+ (void)instanceRelease {
|
||||
if(theLinphoneManager != nil) {
|
||||
[theLinphoneManager release];
|
||||
theLinphoneManager = nil;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
|
|
@ -376,18 +384,17 @@ static void linphone_iphone_text_received(LinphoneCore *lc, LinphoneChatRoom *ro
|
|||
|
||||
#pragma mark - Network Functions
|
||||
|
||||
- (void)kickOffNetworkConnection {
|
||||
+ (void)kickOffNetworkConnection {
|
||||
/*start a new thread to avoid blocking the main ui in case of peer host failure*/
|
||||
[NSThread detachNewThreadSelector:@selector(runNetworkConnection) toTarget:self withObject:nil];
|
||||
}
|
||||
|
||||
- (void)runNetworkConnection {
|
||||
CFWriteStreamRef writeStream;
|
||||
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"192.168.0.200"/*"linphone.org"*/, 15000, nil, &writeStream);
|
||||
CFWriteStreamOpen (writeStream);
|
||||
const char* buff="hello";
|
||||
CFWriteStreamWrite (writeStream,(const UInt8*)buff,strlen(buff));
|
||||
CFWriteStreamClose (writeStream);
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
CFWriteStreamRef writeStream;
|
||||
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"192.168.0.200"/*"linphone.org"*/, 15000, nil, &writeStream);
|
||||
CFWriteStreamOpen (writeStream);
|
||||
const char* buff="hello";
|
||||
CFWriteStreamWrite (writeStream,(const UInt8*)buff,strlen(buff));
|
||||
CFWriteStreamClose (writeStream);
|
||||
CFRelease(writeStream);
|
||||
});
|
||||
}
|
||||
|
||||
static void showNetworkFlags(SCNetworkReachabilityFlags flags){
|
||||
|
|
@ -424,7 +431,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
if ((flags == 0) || (flags & networkDownFlags)) {
|
||||
linphone_core_set_network_reachable([LinphoneManager getLc],false);
|
||||
lLinphoneMgr.connectivity = none;
|
||||
[[LinphoneManager instance] kickOffNetworkConnection];
|
||||
[LinphoneManager kickOffNetworkConnection];
|
||||
} else {
|
||||
Connectivity newConnectivity;
|
||||
BOOL isWifiOnly = lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]),"app","wifi_only_preference",FALSE);
|
||||
|
|
@ -645,6 +652,10 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
[mIterateTimer invalidate];
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
[audioSession setDelegate:nil];
|
||||
if (settingsStore != nil) {
|
||||
[settingsStore release];
|
||||
settingsStore = nil;
|
||||
}
|
||||
if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Destroy linphonecore"];
|
||||
linphone_core_destroy(theLinphoneCore);
|
||||
|
|
@ -688,7 +699,7 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
return;
|
||||
}
|
||||
//kick up network cnx, just in case
|
||||
[self kickOffNetworkConnection];
|
||||
[LinphoneManager kickOffNetworkConnection];
|
||||
[self refreshRegisters];
|
||||
linphone_core_iterate(theLinphoneCore);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@
|
|||
[contentView release];
|
||||
[stateBarView release];
|
||||
[tabBarView release];
|
||||
[viewControllerCache removeAllObjects];
|
||||
[viewControllerCache release];
|
||||
[viewTransition release];
|
||||
[currentViewDescription release];
|
||||
|
||||
[super dealloc];
|
||||
|
|
@ -251,7 +252,7 @@
|
|||
if(name != nil) {
|
||||
controller = [viewControllerCache objectForKey:name];
|
||||
if(controller == nil) {
|
||||
controller = [[NSClassFromString(name) alloc] init];
|
||||
controller = [[[NSClassFromString(name) alloc] init] autorelease];
|
||||
[viewControllerCache setValue:controller forKey:name];
|
||||
[controller view]; // Load the view
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self removeTarget:self action:@selector(___touchDown:) forControlEvents:UIControlEventTouchDown];
|
||||
[self removeTarget:self action:@selector(___touchUp:) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)___touchDown:(id) sender {
|
||||
[self performSelector:@selector(doLongTouch) withObject:nil afterDelay:0.5];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ NSTimer *callSecurityTimer;
|
|||
break;
|
||||
case LinphoneRegistrationNone:
|
||||
registrationStateImage.hidden = NO;
|
||||
image =[UIImage imageNamed:@"led_disconnected.png"];
|
||||
image = [UIImage imageNamed:@"led_disconnected.png"];
|
||||
break;
|
||||
case LinphoneRegistrationProgress:
|
||||
registrationStateImage.hidden = NO;
|
||||
|
|
|
|||
|
|
@ -348,6 +348,8 @@
|
|||
- (void)dealloc {
|
||||
// Remove all observer
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[settingsController release];
|
||||
[navigationController release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
@ -499,6 +501,10 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
NSString *key = [specifier.specifierDict objectForKey:kIASKKey];
|
||||
#ifdef DEBUG
|
||||
if([key isEqual:@"release_button"]) {
|
||||
[[UIApplication sharedApplication].keyWindow.rootViewController release];
|
||||
[[UIApplication sharedApplication].keyWindow setRootViewController:nil];
|
||||
[[LinphoneManager instance] destroyLibLinphone];
|
||||
[LinphoneManager instanceRelease];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef info, void
|
|||
- (void)dealloc {
|
||||
ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self);
|
||||
CFRelease(addressBook);
|
||||
[addressBookMap release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue