Re: asfrent - r29822 - abiword/branches/dblbuffering/src/text/fmt/xp

From: J.M. Maurer <uwog_at_uwog.net>
Date: Sun Jun 19 2011 - 21:19:06 CEST

> // CHECK_WINDOW_SIZE
> @@ -4678,6 +4679,8 @@
> * STEP 2: Draw pages *
> **********************/
>
> + bool dblBufferingToken = painter.beginDoubleBuffering();
> +

> -
> + painter.endDoubleBuffering(dblBufferingToken);
> }

Wouldn't it be better to make painter.beginDoubleBuffering() return an
object that can be placed on the stack? If you do that, then you can
call painter.endDoubleBuffering() in that object's destructor.

That means you never have to match up the begin() and end() calls
manually, and you can never forget one. Not even when the someone
returns from the current function in between the begin() and end()
calls.

We use this same mechanism for our GR_Painter objects.
Received on Sun Jun 19 21:19:20 2011

This archive was generated by hypermail 2.1.8 : Sun Jun 19 2011 - 21:19:20 CEST