uiWindowTitle
rjopek opened this issue · 0 comments
rjopek commented
This example works fine, it is OK after closing.
If we change the line 40 to 41the program hangs on closing.
After removing the uiUninit () function in both cases the program works correctly.
#include <stdio.h>
#include <string.h>
#include "../../ui.h"
static int onClosing(uiWindow *w, void *data)
{
uiQuit();
return 1;
}
static int onShouldQuit(void *data)
{
uiWindow *mainwin = uiWindow(data);
uiControlDestroy(uiControl(mainwin));
return 1;
}
static uiWindow *mainwin;
int main(void)
{
uiInitOptions options;
const char *err;
memset(&options, 0, sizeof(uiInitOptions));
err = uiInit(&options);
if (err != NULL)
{
fprintf(stderr, "error initializing libui: %s", err);
uiFreeInitError(err);
return 1;
}
mainwin = uiNewWindow("libui Control Gallery", 640, 480, 1);
uiWindowOnClosing(mainwin, onClosing, NULL);
uiOnShouldQuit(onShouldQuit, mainwin);
/* uiWindowSetChild(mainwin, uiControl(uiNewLabel(uiWindowTitle(mainwin)))); */
uiWindowSetChild(mainwin, uiControl(uiNewLabel("uiWindowTitle")));
uiControlShow(uiControl(mainwin));
uiMain();
uiUninit();
return 0;
}