Re: [Ekiga-devel-list] Real Issue is Opal::Call virtual table missing



Le 09/01/2013 08:37, Julien Puydt a écrit :
Le 09/01/2013 00:16, Lorin Melander a écrit :
Ekiga::Call *call = (Ekiga::Call *) data;<---- is this you want to know ?

YES! That is what I wanted to know! It's a bare pointer! Nothing smart
in it! No wonder the object gets destroyed in our back: we don't hold
any reference to it officially!

Here is a patch -- can you confirm it fixes the issue?

Snark
diff --git a/plugins/libnotify/libnotify-main.cpp b/plugins/libnotify/libnotify-main.cpp
index b4ea8f2..e2136d9 100644
--- a/plugins/libnotify/libnotify-main.cpp
+++ b/plugins/libnotify/libnotify-main.cpp
@@ -81,12 +81,24 @@ private:
   container_type live;
 };
 
+struct call_notification_keep_call_alive
+{
+  boost::shared_ptr<Ekiga::Call> call;
+};
+
+static void
+delete_call_notification_keep_call_alive (struct call_notification_keep_call_alive* data)
+{
+  data->call.reset();
+  delete data;
+}
+
 static void
 call_notification_action_cb (NotifyNotification *notification,
                              gchar *action,
                              gpointer data)
 {
-  Ekiga::Call *call = (Ekiga::Call *) data;
+  boost::shared_ptr<Ekiga::Call> call = ((struct call_notification_keep_call_alive *) data)->call;
 
   notify_notification_close (notification, NULL);
   if (!strcmp (action, "accept"))
@@ -267,8 +279,12 @@ LibNotify::on_call_notification (boost::shared_ptr<Ekiga::CallManager> manager,
 #endif
 #endif
                                     );
-  notify_notification_add_action (notify, "reject", _("Reject"), call_notification_action_cb, call.get (), NULL);
-  notify_notification_add_action (notify, "accept", _("Accept"), call_notification_action_cb, call.get (), NULL);
+  struct call_notification_keep_call_alive* dcnkca1 = new struct call_notification_keep_call_alive;
+  dcnkca1->call = call;
+  notify_notification_add_action (notify, "reject", _("Reject"), call_notification_action_cb, dcnkca1, (GFreeFunc)delete_call_notification_keep_call_alive);
+  struct call_notification_keep_call_alive* dcnkca2 = new struct call_notification_keep_call_alive;
+  dcnkca2->call = call;
+  notify_notification_add_action (notify, "accept", _("Accept"), call_notification_action_cb, dcnkca2, (GFreeFunc)delete_call_notification_keep_call_alive);
   notify_notification_set_timeout (notify, NOTIFY_EXPIRES_NEVER);
   notify_notification_set_urgency (notify, NOTIFY_URGENCY_CRITICAL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]