Increase ref on event token

This commit is contained in:
LAGonauta 2021-02-22 06:23:08 -03:00
parent 13e0a5c0c4
commit 8df226ec29
2 changed files with 3 additions and 2 deletions

View file

@ -56,8 +56,8 @@ winrt::event_token* winrt_event_token_get_internal(winrtEventToken *self)
winrtEventToken* winrt_event_token_new_from_token(winrt::event_token* token)
{
auto ret = static_cast<winrtEventToken*>(g_object_new (WINRT_TYPE_EVENT_TOKEN, NULL));
// winrtEventTokenPrivate* priv = WINRT_EVENT_TOKEN_GET_PRIVATE(ret);
// priv->token = new winrt::event_token(*token);
winrtEventTokenPrivate* priv = WINRT_EVENT_TOKEN_GET_PRIVATE(ret);
priv->token = new winrt::event_token(*token);
return ret;
}

View file

@ -252,6 +252,7 @@ winrtEventToken* winrt_windows_ui_notifications_toast_notification_Activated(win
priv->activated.callback(wsview_to_char(arguments.data()), nullptr /* user_input */ , 0 /* user_input.size() */, priv->activated.context);
});
priv->activated.token = winrt_event_token_new_from_token(&token);
g_object_ref(priv->activated.token);
return priv->activated.token;
}