missing _copy [Re: $region->get_clipbox copy rect]




On Jan 12, 2008, at 3:30 PM, Kevin Ryde wrote:

The program foo.pl below prints some garbage numbers like

        x=0 y=135599760 w=-1078227492 h=32

where I hoped it'd be all zeros for an empty region, or at least zero
width and height.  In gdk_region_get_clipbox, should the return be
"GdkRectangle_copy" for a rectangle that starts life only on the stack?

Correct.  Good catch.

Fixed in HEAD.


I did a bit of an audit, with some very embarrassing code to scan for stack variables and xsub return types and PPCODE that doesn't use newSV $type_copy(). I found:

xs/GdkPango.xs:115: stack PangoColor color returned without copy typemap
xs/GtkStatusIcon.xs:107: stack GdkRectangle pushed onto perl stack without copy xs/PangoAttributes.xs:305: stack PangoColor color returned without copy typemap xs/PangoAttributes.xs:418: stack PangoColor copy returned without copy typemap


The one in GtkStatusIcon.xs was definitely a bug; fixed and added a unit test.


The ones involving PangoColors baffle me. They look like bugs in the code, but they have unit tests that show them to work correctly.


--
If the monkey could type one keystroke every nanosecond, the expected waiting time until the monkey types out Hamlet is so long that the estimated age of the universe is insignificant by comparison ... this is not a practical method for writing plays.
  -- Gian-Carlo Rota





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]