diff --git a/include/linphone/utils/general.h b/include/linphone/utils/general.h index 1ccee3b72..7ade05a19 100644 --- a/include/linphone/utils/general.h +++ b/include/linphone/utils/general.h @@ -180,6 +180,15 @@ struct AddConstMirror { >::type * \ >(CLASS::mPrivate); +// Get Private data of class in a multiple inheritance case. +#define L_Q_T(CLASS, NAME) \ + auto const NAME = static_cast< \ + AddConstMirror< \ + std::remove_reference::type, \ + CLASS \ + >::type * \ + >(getPublic()); + #define L_OVERRIDE_SHARED_FROM_THIS(CLASS) \ inline std::shared_ptr getSharedFromThis () { \ return std::static_pointer_cast(Object::getSharedFromThis()); \ diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index aee176244..15d7d0251 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -41,11 +41,12 @@ ClientGroupChatRoomPrivate::ClientGroupChatRoomPrivate (LinphoneCore *core) : Ch shared_ptr ClientGroupChatRoomPrivate::createSession () { L_Q(); + L_Q_T(RemoteConference, qConference); CallSessionParams csp; csp.addCustomHeader("Require", "recipient-list-invite"); - shared_ptr focus = static_cast(q)->getPrivate()->focus; + shared_ptr focus = qConference->getPrivate()->focus; shared_ptr session = focus->getPrivate()->createSession(*q, &csp, false, q); const Address &myAddress = q->getMe()->getAddress(); session->configure(LinphoneCallOutgoing, nullptr, nullptr, myAddress, focus->getAddress()); @@ -58,8 +59,8 @@ shared_ptr ClientGroupChatRoomPrivate::createSession () { } void ClientGroupChatRoomPrivate::notifyReceived (string body) { - L_Q(); - static_cast(q)->getPrivate()->eventHandler->notifyReceived(body); + L_Q_T(RemoteConference, qConference); + qConference->getPrivate()->eventHandler->notifyReceived(body); } // =============================================================================