KanzakiKino / w4d

Widgets Library for dlang.
GNU Lesser General Public License v3.0
6 stars 1 forks source link

Failed to place the too big child. #7

Closed WebFreak001 closed 6 years ago

WebFreak001 commented 6 years ago
w4d.layout.exception.LayoutException@../../.dub/packages/w4d-master/w4d/src/w4d/layout/split.d(19): Failed to place the too big child.
----------------
/usr/include/dlang/dmd/std/exception.d:515 void std.exception.bailOut!(w4d.layout.exception.LayoutException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0xb9727c15]
/usr/include/dlang/dmd/std/exception.d:436 bool std.exception.enforce!(w4d.layout.exception.LayoutException).enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0xb971c1e6]
../../.dub/packages/w4d-master/w4d/src/w4d/layout/split.d:19 void w4d.layout.split.SplitLayout!(true).SplitLayout.updateStatus(g4d.math.vector.Vector!(float, 2u).Vector) [0xb970b549]
../../.dub/packages/w4d-master/w4d/src/w4d/layout/lineup.d:47 void w4d.layout.lineup.LineupLayout!(true).LineupLayout.place(g4d.math.vector.Vector!(float, 2u).Vector, g4d.math.vector.Vector!(float, 2u).Vector) [0xb971d0df]
../../.dub/packages/w4d-master/w4d/src/w4d/widget/base/package.d:129 g4d.math.vector.Vector!(float, 2u).Vector w4d.widget.base.Widget.layout(g4d.math.vector.Vector!(float, 2u).Vector, g4d.math.vector.Vector!(float, 2u).Vector) [0xb97108ca]
../../.dub/packages/w4d-master/w4d/src/w4d/widget/base/package.d:122 void w4d.widget.base.Widget.layout(g4d.math.vector.Vector!(int, 2u).Vector) [0xb9710854]
../../.dub/packages/w4d-master/w4d/src/w4d/widget/root.d:35 void w4d.widget.root.RootWidget.layout(g4d.math.vector.Vector!(int, 2u).Vector) [0xb9719474]
../../.dub/packages/w4d-master/w4d/src/w4d/task/window.d:114 bool w4d.task.window.Window.exec(w4d.app.App) [0xb970ef36]
../../.dub/packages/w4d-master/w4d/src/w4d/app.d:45 bool w4d.app.App.exec().__lambda1!(w4d.app.Task).__lambda1(w4d.app.Task) [0xb970a5b1]
/usr/include/dlang/dmd/std/algorithm/mutation.d:2397 w4d.app.Task[] std.algorithm.mutation.removePredStable!(w4d.app.App.exec().__lambda1, w4d.app.Task[]).removePredStable(w4d.app.Task[]) [0xb970a52c]
/usr/include/dlang/dmd/std/algorithm/mutation.d:2250 w4d.app.Task[] std.algorithm.mutation.remove!(w4d.app.App.exec().__lambda1, 2, w4d.app.Task[]).remove(w4d.app.Task[]) [0xb970a4d4]
../../.dub/packages/w4d-master/w4d/src/w4d/app.d:45 int w4d.app.App.exec() [0xb970a3e0]
source/app.d:27 _Dmain [0xb9546e5f]

this issue seems to happen a lot. Also happens in the imgviewer example when resizing around

KanzakiKino commented 6 years ago

Please update w4d ~master if you are using older than 65f0d869a4d7e5dd4e13cb443cd2619da3a8664a. (It's about time to release new version...)

WebFreak001 commented 6 years ago

after an upgrade it crashes on startup:

Thread 4 "test" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe673a700 (LWP 15430)]
0x0000555555cb9924 in derelict.util.loader.SharedLibLoader.load() (this=0x0) at ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/derelict/util/loader.d:82
82                  load(_libNames);
(gdb) bt
#0  0x0000555555cb9924 in derelict.util.loader.SharedLibLoader.load() (this=0x0) at ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/derelict/util/loader.d:82
#1  0x0000555555ca3d81 in initGLFW () at ../../.dub/packages/g4d-1.4.0/g4d/src/g4d/glfw/lib.d:38
#2  0x0000555555c9bda9 in g4d.glfw.window.Window._staticCtor_L30_C13() () at ../../.dub/packages/g4d-1.4.0/g4d/src/g4d/glfw/window.d:32
#3  0x0000555555c9bdc5 in g4d.glfw.window.__modctor() ()
#4  0x0000555555d2bbde in _D2rt5minfo__T14runModuleFuncsSQBdQBd11ModuleGroup11runTlsCtorsMFZ9__lambda1ZQClMFAxPyS6object10ModuleInfoZv ()
#5  0x0000555555d2b929 in rt.minfo.ModuleGroup.runTlsCtors() ()
#6  0x0000555555cd2e04 in _D2rt5minfo16rt_moduleTlsCtorUZ14__foreachbody1MFKSQBx19sections_elf_shared3DSOZi ()
#7  0x0000555555cd31a5 in _D2rt19sections_elf_shared3DSO7opApplyFMDFKSQBqQBqQyZiZi ()
#8  0x0000555555cd2ded in rt_moduleTlsCtor ()
#9  0x0000555555d1d914 in thread_entryPoint ()
#10 0x00007ffff4796075 in start_thread () from /usr/lib/libpthread.so.0
#11 0x00007ffff3d1653f in clone () from /usr/lib/libc.so.6

crashing on this line:

DerelictGLFW3.load();

because DerelictGLFW3 is null (the shared static this in derelict glfw runs after your one). I'm not really sure why this happens because according to https://dlang.org/spec/class.html#StaticConstructor it's supposed to run imported ones before.

KanzakiKino commented 6 years ago

I'll restore to initialize GLFW right before creating Window. (It's too curiously, it worked on my pc...)

WebFreak001 commented 6 years ago

hm issue still happening. Happens when I have a TextWidget which is larger than the window or space it has. I simply removed the exception and set the size to 0 in the code and it worked fine for me, any reason why that should terminate the program?

KanzakiKino commented 6 years ago

SplitLayout calculates the remained size for next child to place. But a bigger child than client area makes the size to negative. Then the layout cannot calculates styles of next child. So if you want to treat big widgets, use other layout or limit a window size.

(The exception doesn't have meaning if the child is last.) (In your case, text auto-wrap(not implemented) can evade this problem.)

WebFreak001 commented 6 years ago

I think it's bad if it can even crash the program if the user resizes the window. It should rather just ignore it, write a warning to the console and make it bigger than the window. Sure a few pixels might not be accessible, but at least the program still runs then

KanzakiKino commented 6 years ago

I changed to output warnings instead of throwing exception.

WebFreak001 commented 6 years ago

thanks! Will there eventually be a logging mechanism like using std.experimental.logger?