andlabs / andlabs/libui

A Julia binding and a crash on second call.

オープン
#75 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C
スター
10.9k
フォーク
612
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi, on Windows10 64 here

I made a quick [wrapper ](https://github.com/joa-quim/Libui.jl) of libui to Julia and ported the `controlgallery` example as well a very stripped down example that looks almost like in C

```
o = Libui.uiInitOptions(0);
err = uiInit(Ref(o));
menu = uiNewMenu("File");

item = uiMenuAppendItem(menu, "Item");
item = uiMenuAppendQuitItem(menu);
mainwin = uiNewWindow("Window", 640, 480, 1);
uiWindowOnClosing(mainwin, cfunction(onClosing, Ptr{Void}, (Ptr{uiWindow},)), C_NULL);
uiControlShow(convert(Ptr{uiControl}, mainwin));
uiMain();
uiUninit();
```

The thing is that this works on first call but crashes on second. I than built a libui debug version and caught the crash inside debug.cpp/realbug() at the end of that function.

Don't know what made it crash but noticed that the `msg` variable in that function has this content

```
Some data was leaked; either you left a uiControl lying around or there's a bug in libui itself. Leaked data:
00000000001FE340 char[]
```

Ah, and the crash seams to be triggered by the `menu = uiNewMenu("File");` command. If I comment it above than no crash.
Note that when we run it via Julia any eventual leaks/conflicts left over from first call are potentially left visible in posteriors calls, but the same is probably true for other language bindings.

Joaquim

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。