1

Simply enough, I'm having an issue where I'm getting a segfault when calling a libnotify function. Erroring code:

int lua_libnotify_new(lua_State *L) {
    const char *summary = luaL_checkstring(L, 1);
    const char *body = lua_isstring(L, 2) ? lua_tostring(L, 2) : NULL;
    const char *icon = lua_isstring(L, 3) ? lua_tostring(L, 3) : NULL;
    NotifyNotification *notification = (NotifyNotification *)lua_newuserdata(L, sizeof(NotifyNotification));
    /* Error is the below line */
    notify_notification_update(notification, summary, body, icon);
    return 1;
}
4

1 回答 1

0

经过一番修改,我意识到它应该是 sizeof(NotifyNotification*)。解决。

于 2015-11-06T20:09:02.427 回答