Re: SIGSEGV one sample application




2015-08-13 22:28 GMT+02:00 Emil Nowak <emiml wp pl>:
Hello,
I'm having problems running just a simple application. I got Segmentation
fault with almost empty backtrace, so can't find what is wrong.
The code looks like this:

main.cc file:
#include "MainWindow.h"
int main(int argc, char **argv) {
        Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc,
argv); MainWindow window;
        return app->run(window);
}

MainWindow.cc file:
#include "MainWindow.h"

MainWindow::MainWindow() {
    Gtk::HPaned mainHPaned;
    mainHPaned.set_position(50);

    Gtk::Label label1;
    label1.set_text("the first label");
    mainHPaned.add1(label1);

    Gtk::Label label2;
    label2.set_text("that is the second label");
    mainHPaned.add2(label2);

    this->add(mainHPaned);
    this->show_all();
}

When I run it in debugger:
Using host libthread_db library
"/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1". [New Thread 0xb5b5db40 (LWP
4799)]

Program received signal SIGSEGV, Segmentation fault.
0x006c6562 in ?? ()
(gdb) bt
#0  0x006c6562 in ?? ()
#1  0xbffff54c in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


My environment is:
g++ version is 4.9.3,
gtkmm 3.16.0

Can you tell me what is wrong with this sample, or how to get more details in
debugging?
Do you use "-g" flag ([1]) for compilation command? Have you installed gtkmm debug symbols?

[1] https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html



--
Best regards,
Marcin Kolny


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]