Skip to content

Commit

Permalink
Avoid potential crash occurring after calling win->show(0,0)
Browse files Browse the repository at this point in the history
See [fltk.general] Drawing to Fl_Offscreen received signal SIGSEGV, Segmentation fault.
that is unrelated to Fl_Offscreen but caused by calling win->show(0,0).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12179 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Feb 22, 2017
1 parent 393e481 commit aa917d7
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/drivers/X11/Fl_X11_Window_Driver.cxx
Expand Up @@ -533,15 +533,17 @@ void Fl_X11_Window_Driver::show_with_args_begin() {


void Fl_X11_Window_Driver::show_with_args_end(int argc, char **argv) {
// set the command string, used by state-saving window managers:
int j;
int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
char *buffer = new char[n];
char *p = buffer;
for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
XChangeProperty(fl_display, fl_xid(pWindow), XA_WM_COMMAND, XA_STRING, 8, 0,
(unsigned char *)buffer, p-buffer-1);
delete[] buffer;
if (argc) {
// set the command string, used by state-saving window managers:
int j;
int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
char *buffer = new char[n];
char *p = buffer;
for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
XChangeProperty(fl_display, fl_xid(pWindow), XA_WM_COMMAND, XA_STRING, 8, 0,
(unsigned char *)buffer, p-buffer-1);
delete[] buffer;
}
}


Expand Down

0 comments on commit aa917d7

Please sign in to comment.