c - 使用 C 函数 notify_notification_update() 的段错误

标签 c lua gtk libnotify

很简单,我在调用 libnotify 函数时遇到段错误。错误代码:

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;
}

最佳答案

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

关于c - 使用 C 函数 notify_notification_update() 的段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33559657/

相关文章:

css - gtk+ 使用 css 更改按钮

c - 将 asm 嵌入到 C 编程中

c++ - 为什么 NMake 生成器将 C 文件的 .obj 文件放在 C++ 目录以外的目录中

lua - 比较 LUA 中的整数变量

c++ - 在 C++ 游戏引擎中使用 Lua 定义 NPC 行为

c++ - 实时移动 GTK+ 窗口

c - 使用semget/semctl使用信号量与使用sem_init/post/wait有什么区别?

C: Scanf 字符串,字段跳过器 "%*"应用于 while 循环中的转换说明符

c++ - Lua RPC 和用户数据

gtk - 如何按标题查找 gtkwindow