r12006 - gnucash/trunk - Convert a couple of dialogs from the deprecated gnome_ok_dialog to a

David Hampton hampton-gnucash at rainbolthampton.net
Mon Nov 21 09:49:40 EST 2005


On Mon, 2005-11-21 at 09:38 +0100, Christian Stimming wrote:
> Hi David,
> 
> thanks for converting these dialog functions into the up-to-date 
> gtk_message_dialog functions. However, IMHO there's one caveat here: The 
> gtk_message_dialog_new() expects a printf()-style char* message_format 
> string as the first text message, and only the subsequent arguments are 
> pure strings that will be shown. In other words, if the first char* 
> argument or any of its translations inadvertantly contains a '%' 
> character, then this will be misinterpreted as a formatting argument and 
> the function will crash. This means that any gtk_message_dialog_new with 
> only one string argument needs to be written as
> (..., "%s", message_string);
> instead. It is not sufficient to check that the message string doesn't 
> contain a '%' character -- any of its translations might contain one, so 
> that's out of the programmer's control. Or did I miss something here?

No, that's a perfectly valid statement.  I hadn't expected that to be a
issue that since the '%' character is used so infrequently in normal
text.  I will always use the (..., "%s", string) form in the future.

David




More information about the gnucash-devel mailing list