Comments (12)
Cannot reproduce. My best guess is that one of the data files hasn't been updated in your data install folder (from the last commits)
from kiui.
I have the same problem with the latest master. I'm getting a segfault with the following backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7a082cb in mk::Dockbar::vappend (this=0x91c740, widget=std::unique_ptr<mk::Widget> containing 0x0) at /home/users/morozov/Projects/U
pstream/kiui/src/Ui/Scheme/mkDockbar.cpp:57
(gdb) back
#0 0x00007ffff7a082cb in mk::Dockbar::vappend (this=0x91c740, widget=std::unique_ptr<mk::Widget> containing 0x0) at /home/users/morozov/Projec
ts/Upstream/kiui/src/Ui/Scheme/mkDockbar.cpp:57
#1 0x00007ffff7ab8f6e in mk::Sheet::emplace<mk::StyleEdit, mk::Styler&> (this=0x91c740) at /home/users/morozov/Projects/Upstream/kiui/src/Ui/W
idget/mkSheet.h:54
#2 0x00007ffff7aac6f0 in mk::createUiStyleEdit (parent=...) at /home/users/morozov/Projects/Upstream/kiui/src/Ui/mkUiExample.cpp:520
#3 0x00007ffff7aace8e in mk::createUiTest (root=...) at /home/users/morozov/Projects/Upstream/kiui/src/Ui/mkUiExample.cpp:593
#4 0x000000000041e5d2 in main (argc=1, argv=0x7fffffffe488) at /home/users/morozov/Projects/Upstream/kiui/example/example.cpp:36
(gdb) up
#1 0x00007ffff7ab8f6e in mk::Sheet::emplace<mk::StyleEdit, mk::Styler&> (this=0x91c740) at /home/users/morozov/Projects/Upstream/kiui/src/Ui/W
idget/mkSheet.h:54
(gdb) down
#0 0x00007ffff7a082cb in mk::Dockbar::vappend (this=0x91c740, widget=std::unique_ptr<mk::Widget> containing 0x0) at /home/users/morozov/Projec
ts/Upstream/kiui/src/Ui/Scheme/mkDockbar.cpp:57
from kiui.
Exactly same bt on very fresh installation of debian 9
Vote up. It's a blocker on Linux.
from kiui.
I'll investigate, but if someone on the system where it fails, can step the debugger to find a plausible origin, it's welcome.
from kiui.
The problem turns out to be very simple. std::move()
in that last line (mkDockbar.cpp:57) destroys the contents of the widget
unique_ptr
. When it tries to call widget->name()
, things break. The fix, of course, is trivial:
auto name = widget->name();
return this->addDock(name, icon, std::move(widget));
from kiui.
auto name = widget->name();
Not resolves problem. Because signature of this function:
const string &Widget::name()
which in this case returns reference to temporary and leads to segfault
See fix in a pull request #28
Please, merge
Regards, Alexey Knyshev
from kiui.
That's strange. Not only do I not see the second segfault, but the way I understand auto
type deduction, in
auto name = widget->name();
auto
gets resolved to string
and one simply gets a local copy.
from kiui.
auto is resolved into direct return type which in this case in
const string &
And it is reference to string object in widget, so then it is going to be destroyed when widget is destroyed.
from kiui.
I really don't think that's how auto
type deduction works. Here's a simple test for you, compile and try for yourself.
#include <type_traits>
struct A
{
struct B {};
const B& f () { return b; }
B b;
};
int main()
{
A a;
auto x = a.f();
static_assert(std::is_same<decltype(x), A::B>::value, "A::B");
static_assert(std::is_same<decltype(x), const A::B&>::value, "const A::B&");
}
Also worth noting, widget
doesn't get destroyed anywhere in this function; a unique_ptr
to it simply gets moved. So even if name
was a const-reference, nothing would break — the addresses don't change.
from kiui.
Sorry, was asleep while writting comment about auto. Everything is ok with:
auto name = widget->name()
Regrads, Alexey Knyshev
from kiui.
BTW, my pull request is ok and may be merged 😄
from kiui.
Aaah yeah, the order isn't guaranteed to be ->name before std::move. Makes a lot of sense. Thanks for finding it while I'm away from computer.
from kiui.
Related Issues (20)
- startup rendering erros HOT 10
- File Browser demo crash HOT 7
- Valgrind report #1 HOT 1
- Filtered demo crash 2 HOT 2
- [Enchantment] Make int/uint overflow optional in TypeIn HOT 4
- [Emscripten] graphical glitches and other minor bugs HOT 1
- [feature request] source code widget HOT 2
- [Emscripten] "Tabs demo" rendering error HOT 2
- Odd textbox behavior in web demo
- Segfault on Ubuntu 14.04
- Lack of documentation on adding kiui to larger cmake project. HOT 4
- Who to use with own/higher opengl Context?
- Examples Failed in Visual studio 2013
- Problems compiling example in MinGW HOT 11
- CMake error in: CHECK_INCLUDE_FILES(dirent.h HAVE_DIRENT_API)
- Just a question re: the current status of kiUi
- linuxmint failed to build HOT 4
- toyui_example fails to work properly on HEAD 6461a83 HOT 4
- unable to build with cmake
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kiui.