-
Notifications
You must be signed in to change notification settings - Fork 5
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
area example segfault on Ubuntu #47
Comments
There should be some problem withthe area file... on Windows 10, I can't compile the project using node 11. I get this error:
I'm investigating further... do you have any idea? |
Have you tried deleting the whole build folder and doing an complete rebuild? (Segfaults also on macOS) |
This is causing the segfault: Line 43 in 1051828
Specifically, the const x = new libui.BrushGradientStop(0, new libui.Color(1, 0, 0, 1))
console.log(x.color); // here So in |
Yes. I cleared all built artifacts and try building from scratch, but no luck. |
Got it! Within make_color function, the handle_scope is not really necessary, because you are calling that function with a JS scope already present in your call stack. If you remove the scope creation code, the segfault go away. Anyway, I don't know why the crash happens... maybe node 11 changed something in the way it hadle nested scopes.... |
Will publish a fix this evening... |
Node 10.12.0 crashes as well, but 8.12.0 doesn't. |
Now, pressing any key on macOS with an area in focus causes a segfault... * frame #0: 0x000000010017ab02 node`v8::Value::ToBoolean(v8::Local<v8::Context>) const + 12
frame #1: 0x0000000100045928 node`napi_coerce_to_bool + 144
frame #2: 0x0000000103e0bd84 ui.node`event_key_cb(h=<unavailable>, a=<unavailable>, e=0x00007ffeefbfe698) at area.c:169 [opt]
frame #3: 0x0000000103e4b2c6 libui.A.dylib`-[areaView sendKeyEvent:] + 86
frame #4: 0x0000000103e4b376 libui.A.dylib`-[areaView doKeyDownUp:up:] + 166
frame #5: 0x0000000103e4b3d0 libui.A.dylib`-[areaView doKeyDown:] + 64
frame #6: 0x0000000103e4b8ca libui.A.dylib`uiprivSendAreaEvents + 314
frame #7: 0x0000000103e6804d libui.A.dylib`-[uiprivApplicationClass sendEvent:] + 29
frame #8: 0x0000000103e6892c libui.A.dylib`uiprivMainStep + 252
frame #9: 0x0000000103e68826 libui.A.dylib`uiMainStep + 118
frame #10: 0x0000000103e13422 ui.node`main_thread(handle=<unavailable>) at event_loop.c:129 [opt]
frame #11: 0x0000000100759318 node`uv__run_timers + 51
frame #12: 0x000000010075c380 node`uv_run + 149
frame #13: 0x0000000100040db7 node`node::Start(v8::Isolate*, node::IsolateData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 1127
frame #14: 0x000000010003fe76 node`node::Start(uv_loop_s*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 333
frame #15: 0x000000010003faef node`node::Start(int, char**) + 241
frame #16: 0x00007fff69902015 libdyld.dylib`start + 1 |
Should be fixed on Node 11 on master by b51baa7. |
Just to clarify: this is different (new) crash (but only with Node 11).
The original crash is fixed on Node 10 as well. |
Good!
I'll test this tomorrow. |
It seems the cause it's the same: fire_event_args open itself a handle scope, and in function event_key_cb we are calling it with another handle scope already open, so we have a nesting of scopes that causes the segfault. |
It seems like this behavior was introduced in Node 10.12.0 (10.11.0 works), but the changelog doesn't list even a single napi change. Is this a bug in Node? |
From node.js docs: "N-API only supports a single nested hierarchy of scopes" and we are effectively using just that: a single level nesting... so yes, it seems to be a Node bug. I add an event to area-adv.js that log arguements for any key pressed. It works fine on Windows 10, could you check master branch on macOS and see if this solve the problem? |
Yes, it works! |
well, it works on Ubuntu too.
Ah yes, good catch... I'll change these other functions too |
I fixed also the mouse & draw callbacks. Strangely, they does'nt cause any segfault. Maybe we are missing or misunderstanding something here? |
Ubuntu 18.10
Node 11
This happens with area.js and area-adv.js, but not area-scrolling.js
Do you know how to get more details? (This is already with
node-gyp configure -d
)The text was updated successfully, but these errors were encountered: