View Issue Details

IDProjectCategoryView StatusLast Update
0021532LazarusLCLpublic2012-03-23 08:25
ReporterLudo Brands Assigned ToPaul Ishenin  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.30.1 (SVN) 
Fixed in Version0.9.31 (SVN) 
Summary0021532: [PATCH] Assigning TStrings to TMemo.Lines breaks TMemo.Lines.Names and TMemo.Lines.Values
DescriptionTWin32MemoStrings.Assign copies happily special characters that where not yet initialised with CheckSpecialChars. As a result assigning a TStrings to TMemo.Lines will copy an empty NameValueSeparator. Subsequent calls to TMemo.Lines.Names and TMemo.Lines.Values fail.

Attached patch and test program.

The patch is based on the fact that GetLBS is the only getter that calls CheckSpecialChars. Therefor moving TextLineBreakStyle := S.TextLineBreakStyle; as the first assignment will call CheckSpecialChars before copying uninitialised data.
TagsNo tags attached.
Fixed in Revision36239
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

2012-03-22 14:56

 

memolines.diff (671 bytes)   
Index: interfaces/win32/win32memostrings.inc
===================================================================
--- interfaces/win32/win32memostrings.inc	(revision 36086)
+++ interfaces/win32/win32memostrings.inc	(working copy)
@@ -131,10 +131,10 @@
   if Source is TStrings then
   begin
     // to prevent Clear and then SetText we need to use our own Assign
+    TextLineBreakStyle := S.TextLineBreakStyle; //put this first to call CheckSpecialChars if not done yet
     QuoteChar := S.QuoteChar;
     Delimiter := S.Delimiter;
     NameValueSeparator := S.NameValueSeparator;
-    TextLineBreakStyle := S.TextLineBreakStyle;
     Text := S.Text;
   end
   else
memolines.diff (671 bytes)   

2012-03-22 14:58

 

testmemolines.zip (2,058 bytes)

Zeljan Rikalo

2012-03-22 15:02

developer   ~0057919

@Paul, please check this one.

Paul Ishenin

2012-03-23 04:45

manager   ~0057933

Thanks, applied.

Please close if ok.

Issue History

Date Modified Username Field Change
2012-03-22 14:56 Ludo Brands New Issue
2012-03-22 14:56 Ludo Brands File Added: memolines.diff
2012-03-22 14:56 Ludo Brands Widgetset => Win32/Win64
2012-03-22 14:58 Ludo Brands File Added: testmemolines.zip
2012-03-22 15:02 Zeljan Rikalo LazTarget => -
2012-03-22 15:02 Zeljan Rikalo Note Added: 0057919
2012-03-22 15:02 Zeljan Rikalo Assigned To => Paul Ishenin
2012-03-22 15:02 Zeljan Rikalo Status new => assigned
2012-03-23 04:45 Paul Ishenin Fixed in Revision => 36239
2012-03-23 04:45 Paul Ishenin Status assigned => resolved
2012-03-23 04:45 Paul Ishenin Fixed in Version => 0.9.31 (SVN)
2012-03-23 04:45 Paul Ishenin Resolution open => fixed
2012-03-23 04:45 Paul Ishenin Note Added: 0057933
2012-03-23 08:25 Ludo Brands Status resolved => closed