Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1091)

Issue 109793010: Prevent crash in Lua bindings. (Closed)

Created:
7 years ago by Tom Hudson
Modified:
7 years ago
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

Prevent crash in Lua bindings. SkPaint::getTypeface() can return NULL; paint:getTypeface() would attempt to refcount that value before storing it on the Lua stack and crash. This is a minimal workaround that fixes the crash. R=reed@google.com Committed: http://code.google.com/p/skia/source/detail?r=12706

Patch Set 1 #

Patch Set 2 : #

Total comments: 1

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -0 lines) Patch
M src/utils/SkLua.cpp View 1 2 7 chunks +31 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
tomhudson
Mike, you wrote the guts of the bindings code - PTAL? Ravi, I need a ...
7 years ago (2013-12-17 14:10:26 UTC) #1
rmistry
On 2013/12/17 14:10:26, tomhudson wrote: > Mike, you wrote the guts of the bindings code ...
7 years ago (2013-12-17 14:12:27 UTC) #2
robertphillips
lgtm - Mike is OOO.
7 years ago (2013-12-17 14:16:59 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/tomhudson@chromium.org/109793010/1
7 years ago (2013-12-17 14:19:47 UTC) #4
commit-bot: I haz the power
Change committed as 12706
7 years ago (2013-12-17 14:28:21 UTC) #5
reed1
This CL also added Annotations, right? Did you not need to peer into the annotation, ...
7 years ago (2013-12-17 16:31:50 UTC) #6
tomhudson
7 years ago (2013-12-17 16:36:58 UTC) #7
Message was sent while issue was closed.
On 2013/12/17 16:31:50, reed1 wrote:
> This CL also added Annotations, right? Did you not need to peer into the
> annotation, to see its key or value?

Patch-set 1 was (or at least should have been the one) landed.

Patch-set 2 was me accidentally re-triggering gcl upload in my shell. I'm trying
to measure the size of paints; if I'm going to do it exactly, I'd need to know
how big SkAnnotations are, which would require exposing more from their public
interface, but in practice we only see them when we're debugging, right? So
they're not performance sensitive and I can assume 1B for the flag that always
gets written.

> https://codereview.chromium.org/109793010/diff/20001/src/utils/SkLua.cpp
> File src/utils/SkLua.cpp (right):
> 
>
https://codereview.chromium.org/109793010/diff/20001/src/utils/SkLua.cpp#newc...
> src/utils/SkLua.cpp:990: SkSafeUnref(get_ref<SkTypeface>(L, 1));
> I believe you, but this just seems wrong. If we had no typeface, we should
have
> pushed a NULL up to lua, instead of a lua object wrapping null.

All I know is that every time I called getTypeface() on a paint with none set,
we returned NULL. As I said in the text this is a minimal workaround; I'm not
surprised if there's a better way to do it.

Powered by Google App Engine
This is Rietveld 408576698