[Ipe-discuss] [PATCH] Color picker crash

Mathias Rav m at strova.dk
Wed Dec 20 11:50:08 CET 2017


In Ipe 7.2.7 I can reproduce a crash with the traceback:

/usr/share/ipe/7.2.7/lua/actions.lua:178: bad argument #2 to 'find' (string expected, got table)
stack traceback:
	[C]: in method 'find'
	/usr/share/ipe/7.2.7/lua/actions.lua:178: in function </usr/share/ipe/7.2.7/lua/actions.lua:175>
	[C]: in function 'mainloop'
	/usr/share/ipe/7.2.7/lua/main.lua:467: in main chunk
	[C]: in function 'require'
	[string "require "main""]:1: in main chunk

I'm running Arch Linux with the Gnome desktop,
Ipe 7.2.7 compiled from source via AUR.

Steps to reproduce:

1. Create an object with an unnamed stroke color (example below)
2. Select the object and click Edit -> Pick properties
3. Click the stroke color button in the 'Properties' toolbar/panel

<path stroke="0.459 0.314 0.482">
112 784 m
160 752 l
</path>

20-second screencast reproducing the crash: https://youtu.be/o0syogiOFvQ

Changing actions.lua as follows prevents the crash:

--- /usr/share/ipe/7.2.7/lua/actions.lua	2017-12-20 11:35:16.871603088 +0100
+++ actions.lua	2017-12-20 11:35:12.735005730 +0100
@@ -175,7 +175,10 @@
 function MODEL:absoluteButton(button)
   -- print("Button:", button)
   if button == "stroke" or button == "fill" then
-    local old = self.doc:sheets():find("color", self.attributes[button])
+    local old = self.attributes[button]
+    if type(old) == "string" then
+      old = self.doc:sheets():find("color", old)
+    end
     r, g, b = ipeui.getColor(self.ui:win(), "Select " .. button .. " color",
 			     old.r, old.g, old.b)
     if r then

Best regards,
Mathias Rav
MADALGO, Aarhus University


More information about the Ipe-discuss mailing list