Page MenuHome

GreasePencil: Modifying name of new color in new palette segfaults
Closed, ResolvedPublic

Description

System Information
Linux Mint (Ubuntu)

Blender Version
Broken: 2.78 729affe

Short description of error
Grease Pencil Palettes are not linked to the scene, renaming their colors' names segfaults

Exact steps for others to reproduce the error

  • open a fresh blend file
  • create a new grease pencil data block (or "New Layer", doesn't change the result)
  • crucial fact is that there is no palette linked to the grease pencil data-block
  • paste the following two lines into the console
scene = bpy.context.scene
palette = scene.grease_pencil.palettes.active or scene.grease_pencil.palettes.new("GP_Palett")
  • observe how the newly created palette is not visible in the UI
  • change the name of a color by executing
mycolor = palette.colors.new()

# this expression segfaults
mycolor.name = "test"

Crucially, changing the hide property doesn't segfault, so name seems to be special.

This segfault is probably only possible via scripting, but still very bad. It was discovered during my work on the Freestyle GPencil Exporter.

Event Timeline

Joshua Leung (aligorith) triaged this task as Confirmed, Medium priority.Nov 27 2016, 12:40 AM

Actually, even just trying to print the mycolor variable (before changing the name) caused a crash in current master.

I previously fixed a bug where this was crashing because a name-setting function here needed the owner-datablock, but that wasn't supplied when accessing this stuff from the context.