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



Le 11/01/2013 20:18, Lorin Melander a écrit :
I run with new patch.
here new result.  The object call still is lost.

Sigh... Let's try with a variant of the first patch :-/

Snark
diff --git a/plugins/libnotify/libnotify-main.cpp b/plugins/libnotify/libnotify-main.cpp
index b4ea8f2..dd04aa0 100644
--- a/plugins/libnotify/libnotify-main.cpp
+++ b/plugins/libnotify/libnotify-main.cpp
@@ -81,18 +81,34 @@ private:
   container_type live;
 };
 
+struct call_notification_keep_call_alive
+{
+  boost::weak_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.lock();
 
   notify_notification_close (notification, NULL);
-  if (!strcmp (action, "accept"))
-    call->answer ();
-  else
-    call->hang_up ();
+
+  if (call) {
+
+    if (!strcmp (action, "accept"))
+      call->answer ();
+    else
+      call->hang_up ();
+  }
 }
 
 static void
@@ -267,8 +283,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]