afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-04-08 03:18 pm

[dw-free] Calling start_css twice in a row (without a end_css in between) prevents any future output

[commit: http://hg.dwscoalition.org/dw-free/rev/c11532760062]

http://bugs.dwscoalition.org/show_bug.cgi?id=690

Handle nested calls to start_css

Patch by [personal profile] exor674.

Files modified:
  • cgi-bin/LJ/S2.pm
--------------------------------------------------------------------------------
diff -r 4a7bcaa21555 -r c11532760062 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Wed Apr 08 12:06:22 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Wed Apr 08 15:17:51 2009 +0000
@@ -2293,6 +2293,10 @@ sub start_css {
 sub start_css {
     my ($ctx) = @_;
     my $sc = $ctx->[S2::SCRATCH];
+
+    # Always increment, but only continue if it was 0
+    return if $sc->{_css_depth}++;
+
     $sc->{_start_css_pout}   = S2::get_output();
     $sc->{_start_css_pout_s} = S2::get_output_safe();
     $sc->{_start_css_buffer} = "";
@@ -2306,6 +2310,9 @@ sub end_css {
 sub end_css {
     my ($ctx) = @_;
     my $sc = $ctx->[S2::SCRATCH];
+
+    # Only decrement _css_depth if it is non-zero, only continue if it becomes zero
+    return unless $sc->{_css_depth} && (--$sc->{_css_depth} == 0);
 
     # restore our printer/safe printer
     S2::set_output($sc->{_start_css_pout});
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org