From 7d2a79c25b75ab1b8637ad091c5d31c374d539d1 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 21 Feb 2013 11:06:37 +0100 Subject: [PATCH] Clean chatroom on core destroy --- Classes/ChatRoomViewController.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index f2cdc2df4..b096f4acd 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -163,6 +163,11 @@ static UICompositeViewDescription *compositeDescription = nil; selector:@selector(onMessageChange:) name:UITextViewTextDidChangeNotification object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(coreUpdateEvent:) + name:kLinphoneCoreUpdate + object:nil]; if([tableController isEditing]) [tableController setEditing:FALSE animated:FALSE]; [editButton setOff]; @@ -206,6 +211,9 @@ static UICompositeViewDescription *compositeDescription = nil; [[NSNotificationCenter defaultCenter] removeObserver:self name:UITextViewTextDidChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self + name:kLinphoneCoreUpdate + object:nil]; } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { @@ -404,6 +412,12 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta #pragma mark - Event Functions +- (void)coreUpdateEvent:(NSNotification*)notif { + if(![LinphoneManager isLcReady]) { + chatRoom = NULL; + } +} + - (void)textReceivedEvent:(NSNotification *)notif { //LinphoneChatRoom *room = [[[notif userInfo] objectForKey:@"room"] pointerValue]; //NSString *message = [[notif userInfo] objectForKey:@"message"];