Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

malloc(): memory corruption (fast): 0x00007f5efe9e1710 #7

Closed
dreamsxin opened this issue Mar 11, 2013 · 2 comments
Closed

malloc(): memory corruption (fast): 0x00007f5efe9e1710 #7

dreamsxin opened this issue Mar 11, 2013 · 2 comments

Comments

@dreamsxin
Copy link

#include <LCUI_Build.h>
#include LC_LCUI_H
#include LC_WIDGET_H 
#include LC_WINDOW_H
#include LC_BUTTON_H

static void
destroy( LCUI_Widget *widget, LCUI_WidgetEvent *unused )
{
    LCUI_MainLoop_Quit(NULL);
}

int main(void) 
{
    LCUI_Widget *window, *button;

    setenv( "LCUI_FONTFILE", "/home/zhuzx/NetBeansProjects/CGUI/fonts/simfang.ttf", FALSE );
    LCUI_Init();
    window  = Widget_New("window");
    button  = Widget_New("button");

    /* 设定窗口标题的文本 */
    Window_SetTitleText(window, "测试按钮"); 
    /* 改变窗口的尺寸 */
    Widget_Resize( window, Size(320, 240) );
    /* 将窗口客户区作为按钮的容器添加进去 */
    Window_ClientArea_Add( window, button );
    /* 居中显示按钮 */
    Widget_SetAlign( button, ALIGN_MIDDLE_CENTER, Pos(0, 0) );
    /* 禁用部件的自动尺寸调整 */
    Widget_SetAutoSize( button, FALSE, 0 );
    /* 自定义按钮的尺寸 */
    Widget_Resize( button, Size(180, 70) );

    /* 设定按钮上显示的文本内容,和label部件的用法一样,支持样式标签 */
    Button_Text( button, 
        "<size=30px><color=255,0,0>彩</color>"
        "<color=0,255,0>色</color>"
        "<color=0,0,255>的</color>"
        "<color=255,255,0>按</color>"
        "<color=255,255,255>钮</color></size>");

    /* 显示部件 */
    Widget_Show( button );
    Widget_Show( window ); 
    Widget_Event_Connect( Window_GetCloseButton(window), EVENT_CLICKED, destroy );
    return LCUI_Main(); /* 进入主循环 */
}
@lc-soft
Copy link
Owner

lc-soft commented Mar 11, 2013

重新编译一下:
configure --enable-debug=yes
make clean
make install
编译出debug版本,然后,再gdb test_button,如果程序异常终止,用back命令查看函数调用栈信息,把它复制出来。
貌似,在控制台模式不好复制gdb打印的内容。。。
可以试试用重定向,gdb test_button >test.txt
输入r+回车,程序异常终止后,再输入back+回车,然后再q+回车,y+回车,gdb打印的内容就重定向输入值test.txt文件了,把文件内容贴上来。

lc-soft added a commit that referenced this issue Mar 12, 2013
当指定的字体路径无效时,LCUI会free掉一次FT库,而在LCUI程序退出时,又会对FT库进行free,导致段错误,现已解决。
@lc-soft
Copy link
Owner

lc-soft commented Mar 12, 2013

刚刚在其它目录里创建了个新程序,由于指定的字体路径无效,会free掉一次FT库,而在LCUI程序退出时,又对FT库进行free,导致段错误。
现已解决,commit信息在此查看:ebdf6fa

@lc-soft lc-soft closed this as completed Mar 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants