View Issue Details

IDProjectCategoryView StatusLast Update
0018584PatchesWidgetsetpublic2011-12-01 11:25
ReporterC Western Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSlinux 
Product Version0.9.31 (SVN) 
Summary0018584: MessageDlg fails is message text contains <, >
DescriptionMessageDlg does not display a string such as MessageDlg("Hello, <a|H|b>"). This appears to be due to the need to properly escape special characters in the string in the gtk2 interface. The attached patch is a possible fix.
Additional InformationThe patch contains:

// Can't pass message string to gtk_message_dialog_new, as % chars are interpreted
// gtk_message_dialog_set_markup interpets HTML, so we need to quote that
 QuotedMessage := g_markup_escape_text(PGChar(DialogMessage), Length(DialogMessage));
 gtk_message_dialog_set_markup(PGtkMessageDialog(Dialog), QuotedMessage);
 g_free(QuotedMessage);
TagsNo tags attached.
Fixed in Revision29159
LazTarget0.9.30
WidgetsetGTK 2
Attached Files

Relationships

related to 0018313 closedZeljan Rikalo Lazarus find dialog access violation 

Activities

2011-01-22 13:15

 

messagedlg.patch (1,224 bytes)   
diff -wuNr --exclude=.svn --exclude=Makefile --exclude=Makefile.fpc --exclude='*.po' lazarus/lcl/interfaces/gtk2/gtk2lclintf.inc lazarus.w/lcl/interfaces/gtk2/gtk2lclintf.inc
--- lazarus/lcl/interfaces/gtk2/gtk2lclintf.inc	2010-12-30 10:37:17.000000000 +0000
+++ lazarus.w/lcl/interfaces/gtk2/gtk2lclintf.inc	2011-01-22 12:05:46.000000000 +0000
@@ -1095,6 +1095,7 @@
   MainList,ChildList: PGList;
   Title: String;
   ActiveWindow: HWND;
+  QuotedMessage: Pgchar;
 
   procedure CreateButton(const ALabel : String; const AResponse: Integer);
   var
@@ -1145,7 +1146,11 @@
   Dialog := gtk_message_dialog_new(nil, GTK_DIALOG_MODAL, GtkDialogType, Btns,
     nil);
 
-  gtk_message_dialog_set_markup(PGtkMessageDialog(Dialog), PGChar(DialogMessage));
+  // Can't pass message string to gtk_message_dialog_new, as % chars are interpreted
+  // gtk_message_dialog_set_markup interpets HTML, so we need to quote that
+  QuotedMessage := g_markup_escape_text(PGChar(DialogMessage), Length(DialogMessage));
+  gtk_message_dialog_set_markup(PGtkMessageDialog(Dialog), QuotedMessage);
+  g_free(QuotedMessage);
   g_signal_connect(PGtkObject(Dialog), 'delete-event',
     TGtkSignalFunc(@PromptUserBoxClosed),
     @ADialogResult);
messagedlg.patch (1,224 bytes)   

C Western

2011-01-22 13:16

reporter   ~0045397

The issue is related to 18313, but the fix introduced there shifted the problem from % to HTML chars

Zeljan Rikalo

2011-01-22 13:29

developer   ~0045398

This is regression , so 0.9.30

Zeljan Rikalo

2011-01-22 13:39

developer   ~0045399

Please and test if ok. Thanks for patch.

Issue History

Date Modified Username Field Change
2011-01-22 13:15 C Western New Issue
2011-01-22 13:15 C Western File Added: messagedlg.patch
2011-01-22 13:15 C Western Widgetset => GTK 2
2011-01-22 13:16 C Western Note Added: 0045397
2011-01-22 13:29 Zeljan Rikalo Status new => assigned
2011-01-22 13:29 Zeljan Rikalo Assigned To => Zeljan Rikalo
2011-01-22 13:29 Zeljan Rikalo LazTarget => 0.9.30
2011-01-22 13:29 Zeljan Rikalo Note Added: 0045398
2011-01-22 13:34 Zeljan Rikalo Relationship added related to 0018313
2011-01-22 13:39 Zeljan Rikalo Fixed in Revision => 29159
2011-01-22 13:39 Zeljan Rikalo Status assigned => resolved
2011-01-22 13:39 Zeljan Rikalo Resolution open => fixed
2011-01-22 13:39 Zeljan Rikalo Note Added: 0045399
2011-01-22 20:34 Vincent Snijders Tag Attached: merge to 0.9.30
2011-02-01 11:42 Joost van der Sluis Tag Detached: merge to 0.9.30
2011-12-01 11:25 Marc Weustink Status resolved => closed