Xournalpp: Crash with many colors

Created on 11 Dec 2019  ·  5Comments  ·  Source: xournalpp/xournalpp

Affects versions :

  • Arch Linux
  • X11
  • extra/gtk3 1:3.24.13-1
  • extra/xournalpp 1.0.16-1

Describe the bug
SEGFAULT

To Reproduce
Steps to reproduce the behavior:

  1. Append the following to ~/.xournalpp/toolbar.ini
[Right hand Pencil Note Taking]
toolbarTop1=NEW,OPEN,SEPARATOR,IMAGE,TEXT,MATH_TEX,SEPARATOR,AUDIO_RECORDING,AUDIO_PAUSE_PLAYBACK,AUDIO_STOP_PLAYBACK,PLAY_OBJECT,SEPARATOR,PRESENTATION_MODE,PAIRED_PAGES,FULLSCREEN,SEPARATOR,ZOOM_FIT,ZOOM_100,ZOOM_SLIDER,ZOOM_OUT,ZOOM_IN,SEPARATOR,DELETE_CURRENT_PAGE,INSERT_NEW_PAGE,SEPARATOR,GOTO_FIRST,GOTO_PAGE,GOTO_NEXT_ANNOTATED_PAGE,GOTO_LAST,PAGE_SPIN,GOTO_BACK,GOTO_NEXT
toolbarTop2=DEFAULT_TOOL,COLOR_SELECT,TOOL_FILL,SEPARATOR,DRAW_CIRCLE,DRAW_COORDINATE_SYSTEM,DRAW_RECTANGLE,DRAW_ARROW,SHAPE_RECOGNIZER,RULER,SEPARATOR,ROTATION_SNAPPING,GRID_SNAPPING,SEPARATOR,VERTICAL_SPACE,SELECT_REGION,SELECT_RECTANGLE,SELECT_OBJECT,SEPARATOR,CUT,COPY,PASTE,SEPARATOR,VERY_THICK,VERY_FINE,FINE,THICK,MEDIUM,SEPARATOR,HILIGHTER,ERASER,PEN,SEPARATOR,SAVE,SEPARATOR,REDO,UNDO
toolbarLeft1=COLOR(0x000000),COLOR(0x500000),COLOR(0x111312),COLOR(0x31302f),COLOR(0x3b3737),COLOR(0x300000),COLOR(0x792929),COLOR(0x44393d),COLOR(0x59636d),COLOR(0x52504e),COLOR(0x234d20),COLOR(0x36802d),COLOR(0x00ff00),COLOR(0x77ab59),COLOR(0xfec52d),COLOR(0xf6cd11),COLOR(0xffff00),COLOR(0xcaff42),COLOR(0xedc951),COLOR(0xf7a541),COLOR(0xeab146),COLOR(0xda825f),COLOR(0xc4975c),COLOR(0xff9b4a),COLOR(0xf38630),COLOR(0xff8000),COLOR(0xf37c00),COLOR(0xfa6900),COLOR(0xe76f3d),COLOR(0xfa5534)
toolbarLeft2=COLOR(0xff0000),COLOR(0xde1300),COLOR(0xd2b028),COLOR(0xcc333f),COLOR(0x991818),COLOR(0x8c2328),COLOR(0x9c3c3e),COLOR(0x96596b),COLOR(0xff3d7f),COLOR(0xff3d7f),COLOR(0xfe4365),COLOR(0xc25264),COLOR(0xff4e50),COLOR(0xec5c56),COLOR(0xf45d4c),COLOR(0xeb6841),COLOR(0xf1754d),COLOR(0xff637d),COLOR(0xf06d61),COLOR(0xa800a8),COLOR(0xff00ff),COLOR(0x00c0ff),COLOR(0x13e6cb),COLOR(0x3fb8af),COLOR(0x3fb8af),COLOR(0x14a888),COLOR(0x00a8d8),COLOR(0x49708a),COLOR(0xf04c81)
name=Right hand Pencil Note Taking
  1. Run xournalpp
  2. Use the new toolbar setting View > Toolbars > Right hand Pencil Note Taking
  3. Select fifth color in toolbarLeft1

Expected behavior
The color is selected for use with the current tool.

Crash bug confirmed high

Most helpful comment

All 5 comments

And here is some log of the crash

Gtk-Message: 14:44:51.465: gtk_widget_set_clip:                    GtkToggleButton -2 279 48 46
Gtk-Message: 14:44:51.644: [0x5592ef5a3370] GtkTooltipWindow    width for height: -1 is minimum 104 and natural: 104 (hit cache: yes)

Gtk-Message: 14:44:51.644: [0x5592ef5a3370] GtkTooltipWindow    height for width: 104 is minimum 55 and natural: 55 (hit cache: yes)

Gtk-Message: 14:44:51.644: [0x5592ef5a3370] GtkTooltipWindow    width for height: -1 is minimum 104 and natural: 104 (hit cache: yes)

Gtk-Message: 14:44:51.644: [0x5592ef5a3370] GtkTooltipWindow    height for width: 104 is minimum 55 and natural: 55 (hit cache: yes)

Gtk-Message: 14:44:51.718: [0x5592efe5ab60] GtkScrollbar    height for width: -1 is minimum 6 and natural: 6 (hit cache: yes)

Gtk-Message: 14:44:51.718: [0x5592efe5ad60] GtkScrollbar    width for height: -1 is minimum 6 and natural: 6 (hit cache: yes)

Gtk-Message: 14:44:51.719: gtk_widget_size_allocate:               GtkToggleButton 4 284 37 35, baseline -1
Gtk-Message: 14:44:51.719: [0x5592f03de480] GtkToggleButton height for width: -1 is minimum 35 and natural: 35 (hit cache: yes)

Gtk-Message: 14:44:51.719: [0x5592f03de480] GtkToggleButton width for height: -1 is minimum 37 and natural: 37 (hit cache: yes)

Gtk-Message: 14:44:51.720: gtk_widget_size_allocate:                 GtkDrawingArea 10 289 24 24, baseline -1
Gtk-Message: 14:44:51.720: [0x5592ef60de70] GtkDrawingArea  height for width: -1 is minimum 16 and natural: 16 (hit cache: yes)

Gtk-Message: 14:44:51.720: [0x5592ef60de70] GtkDrawingArea  width for height: -1 is minimum 16 and natural: 16 (hit cache: yes)

Gtk-Message: 14:44:51.720: gtk_widget_set_clip:                    GtkToggleButton 2 282 40 39
Gtk-Message: 14:44:51.797: gtk_widget_size_allocate:               GtkToggleButton 4 284 37 35, baseline -1
Gtk-Message: 14:44:51.797: [0x5592f03de480] GtkToggleButton height for width: -1 is minimum 35 and natural: 35 (hit cache: yes)

Gtk-Message: 14:44:51.797: [0x5592f03de480] GtkToggleButton width for height: -1 is minimum 37 and natural: 37 (hit cache: yes)

Gtk-Message: 14:44:51.797: gtk_widget_size_allocate:                 GtkDrawingArea 10 289 24 24, baseline -1
Gtk-Message: 14:44:51.797: [0x5592ef60de70] GtkDrawingArea  height for width: -1 is minimum 16 and natural: 16 (hit cache: yes)

Gtk-Message: 14:44:51.797: [0x5592ef60de70] GtkDrawingArea  width for height: -1 is minimum 16 and natural: 16 (hit cache: yes)

Gtk-Message: 14:44:51.798: gtk_widget_set_clip:                    GtkToggleButton 4 284 36 35
fish: “xournalpp --gtk-debug all” terminated by signal SIGSEGV (Address boundary error)

I suspect this is a stack overflow from infinite recursion because the call stack is massive.

Not sure why this works, but a quick workaround is to replace the check on
https://github.com/xournalpp/xournalpp/blob/a8ea6718b66db499ea3e87c45c1db0831a79b9c9/src/gui/toolbarMenubar/ColorToolItem.cpp#L93
with

if (this->color == color)

My experience with the bug is that it seems to always happen with the same colors. In the specific example I gave, I managed to identify and remove the colors causing the crash. I did not investigate further. Maybe I was just lucky.

This also occurs if you select color 3b3737 in the color chooser.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Krzmbrzl picture Krzmbrzl  ·  4Comments

cbm755 picture cbm755  ·  3Comments

siliconninja picture siliconninja  ·  5Comments

student-sx picture student-sx  ·  4Comments

enricoar picture enricoar  ·  3Comments