FLTK logo

Re: [fltk.general] crash in fl_draw

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
[  All Forums  |  Back to fltk.general  ]
 
[ Previous Message ] [ New Message | Reply ] [ Next Message ]

Re: crash in fl_draw imm Oct 26, 2025  
 
With the caveat that I'm on my phone and haven't actually tested your example....


On Sun, 26 Oct 2025, 14:28 'Klaus Rudolph' via fltk.general, <fltkgeneral@googlegroups.com> wrote:
I try to build with fltk1.4.4. the following minimal prog:

class MyWin: public Fl_Window
{
    public:
        MyWin( int x, int y, int w, int h, const char* title = 0 ):
            Fl_Window(x,y,w,h,"Hallo Welt!")


This probably wants to be 

Fl_Window(x,y,w,h,title)

but I doubt that's the issue...

    {  
    }  

        void draw() override
        {
            Fl_Window::draw(); // Das zeichnet den Background neu, falls erforderlich!
            std::cout << "Draw!" << std::endl;
            fl_color( FL_WHITE );
            fl_draw( "Hallo world", 10,20);
        }
};


int main() {
    auto display = new MyWin(1,1,900, 600, "Test");
    display->color(FL_RED);
    display->show();

    Fl::run();
}

Compiled with:
   g++ -g \
        `/home/krud/external_repos/fltk-1.4.4/myinstall/bin/fltk-config --cflags` \
        main.cpp \
        `/home/krud/external_repos/fltk-1.4.4/myinstall/bin/fltk-config --ldflags` \
        -o go 

Got: Program received signal SIGSEGV, Segmentation fault.

Backtrace in gdb:
(gdb) bt
#0  0x000000000043d4fd in Fl_Cairo_Graphics_Driver::draw (this=0x58fce0, str=0x4f969a "Hallo world", n=11, x=10, y=20) at drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx:1343
#1  0x0000000000437913 in Fl_Cairo_Graphics_Driver::draw (this=0x58fce0, s=0x4f969a "Hallo world", nBytes=11, x=10, y=20) at drivers/Cairo/Fl_Cairo_Graphics_Driver.H:170
#2  0x0000000000426308 in fl_draw (str=0x4f969a "Hallo world", n=11, x=10, y=20) at ../FL/fl_draw.H:957
#3  0x0000000000428b57 in fl_draw (str=0x4f969a "Hallo world", x=10, y=20) at fl_font.cxx:33
#4  0x00000000004024a4 in MyWin::draw (this=0x565380) at main.cpp:30
#5  0x000000000041f5a2 in Fl_Window::flush (this=0x565380) at Fl_Window.cxx:487
#6  0x0000000000420db1 in Fl_Window_Driver::flush (this=0x54cf50) at Fl_Window_Driver.cxx:190
#7  0x000000000040304c in Fl::flush () at Fl.cxx:820
#8  0x000000000046c858 in Fl_Unix_System_Driver::wait (this=0x54c240, time_to_wait=1e+20) at drivers/Unix/Fl_Unix_System_Driver.cxx:803
#9  0x0000000000402d79 in Fl::wait (time_to_wait=1e+20) at Fl.cxx:632
#10 0x0000000000402d93 in Fl::run () at Fl.cxx:652
#11 0x0000000000402310 in main () at main.cpp:40

Any idea what I did wrong?

Nothing obvious from looking at the code.

The crash has very much the look of what happens when 1.3.x headers/libs get linked into a 1.4.x program mind you, so it might be interesting to see what your fltk-config invocations are actually getting, and what lib etc gets linked.

Does your system have 1.1 or 1.3 as a system lib?


--
Ian
From my Fairphone FP3
 

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fltkgeneral/CAGFM6dYhX-5O4qCLr2472BsYD1JODe5FKm1MEeeTd1aN_uQH0A%40mail.gmail.com.
[ Direct Link to Message ]
 
     
[ Previous Message ] [ New Message | Reply ] [ Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.