Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
58e13184
Commit
58e13184
authored
Apr 19, 2013
by
Simon Morlat
Browse files
fix crash in gtk chat
parent
846d2c57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
gtk/chat.c
gtk/chat.c
+17
-6
No files found.
gtk/chat.c
View file @
58e13184
...
...
@@ -61,12 +61,17 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
GtkWidget
*
nb
=
linphone_gtk_get_widget
(
main_window
,
"viewswitch"
);
GtkWidget
*
friendlist
=
linphone_gtk_get_widget
(
main_window
,
"contact_list"
);
GtkWidget
*
w
=
g_object_get_data
(
G_OBJECT
(
friendlist
),
"chatview"
);
gchar
*
from
;
g_return_if_fail
(
w
!=
NULL
);
gtk_notebook_remove_page
(
GTK_NOTEBOOK
(
nb
),
gtk_notebook_page_num
(
GTK_NOTEBOOK
(
nb
),
w
));
linphone_gtk_friend_list_update_chat_picture
();
g_object_set_data
(
G_OBJECT
(
friendlist
),
"chatview"
,
NULL
);
g_object_set_data
(
G_OBJECT
(
w
),
"from_message"
,
NULL
);
from
=
g_object_get_data
(
G_OBJECT
(
w
),
"from_message"
);
if
(
from
){
g_object_set_data
(
G_OBJECT
(
w
),
"from_message"
,
NULL
);
g_free
(
from
);
}
g_object_set_data
(
G_OBJECT
(
w
),
"cr"
,
NULL
);
g_object_set_data
(
G_OBJECT
(
friendlist
),
"from"
,
NULL
);
gtk_widget_destroy
(
w
);
...
...
@@ -128,7 +133,7 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
GtkTextIter
iter
,
begin
;
int
off
;
char
*
from_str
=
linphone_address_as_string_uri_only
(
from
);
char
*
from_message
=
(
char
*
)
g_object_get_data
(
G_OBJECT
(
w
),
"from_message"
);
g
char
*
from_message
=
(
g
char
*
)
g_object_get_data
(
G_OBJECT
(
w
),
"from_message"
);
GList
*
list
=
g_object_get_data
(
G_OBJECT
(
w
),
"list"
);
time_t
t
;
char
buf
[
80
];
...
...
@@ -148,8 +153,8 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
gtk_text_buffer_insert_with_tags_by_name
(
buffer
,
&
iter
,
" : "
,
-
1
,
"bold"
,
me
?
"bg"
:
NULL
,
NULL
);
gtk_text_buffer_get_end_iter
(
buffer
,
&
iter
);
gtk_text_buffer_insert
(
buffer
,
&
iter
,
"
\n
"
,
-
1
);
ms
_free
(
from_message
);
g_object_set_data
(
G_OBJECT
(
w
),
"from_message"
,
from_str
);
g
_free
(
from_message
);
g_object_set_data
(
G_OBJECT
(
w
),
"from_message"
,
g_strdup
(
from_str
)
)
;
}
gtk_text_buffer_get_end_iter
(
buffer
,
&
iter
);
gtk_text_buffer_insert_with_tags_by_name
(
buffer
,
&
iter
,
linphone_chat_message_get_text
(
msg
),
-
1
,
"margin"
,
me
?
"bg"
:
NULL
,
NULL
);
...
...
@@ -193,6 +198,7 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
gtk_text_buffer_insert
(
buffer
,
&
iter
,
"
\n
"
,
-
1
);
GtkTextMark
*
mark
=
gtk_text_buffer_create_mark
(
buffer
,
NULL
,
&
iter
,
FALSE
);
gtk_text_view_scroll_mark_onscreen
(
text
,
mark
);
ms_free
(
from_str
);
}
const
LinphoneAddress
*
linphone_gtk_get_used_identity
(){
...
...
@@ -292,6 +298,7 @@ void display_history_message(GtkWidget *chat_view,MSList *messages,const Linphon
MSList
*
it
;
char
*
from_str
;
char
*
with_str
;
gchar
*
tmp
;
for
(
it
=
messages
;
it
!=
NULL
;
it
=
it
->
next
){
LinphoneChatMessage
*
msg
=
(
LinphoneChatMessage
*
)
it
->
data
;
from_str
=
linphone_address_as_string_uri_only
(
linphone_chat_message_get_from
(
msg
));
...
...
@@ -301,7 +308,11 @@ void display_history_message(GtkWidget *chat_view,MSList *messages,const Linphon
strcmp
(
from_str
,
with_str
)
==
0
?
FALSE
:
TRUE
,
linphone_chat_message_get_chat_room
(
msg
),
msg
,
TRUE
);
}
g_object_set_data
(
G_OBJECT
(
chat_view
),
"from_message"
,
NULL
);
tmp
=
g_object_get_data
(
G_OBJECT
(
chat_view
),
"from_message"
);
if
(
tmp
){
g_object_set_data
(
G_OBJECT
(
chat_view
),
"from_message"
,
NULL
);
g_free
(
tmp
);
}
ms_free
(
from_str
);
ms_free
(
with_str
);
linphone_gtk_free_list
(
messages
);
...
...
@@ -420,7 +431,7 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
g_object_set_data
(
G_OBJECT
(
chat_view
),
"cr"
,
cr
);
g_object_set_data
(
G_OBJECT
(
linphone_gtk_get_widget
(
main_window
,
"contact_list"
)),
"chatview"
,(
gpointer
)
chat_view
);
messages
=
linphone_chat_room_get_history
(
cr
,
NB_MSG_HIST
);
g_object_set_data
(
G_OBJECT
(
chat_view
),
"from_message"
,
uri_str
);
g_object_set_data
(
G_OBJECT
(
chat_view
),
"from_message"
,
g_strdup
(
uri_str
)
)
;
display_history_message
(
chat_view
,
messages
,
uri
);
}
ms_free
(
from_str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment