mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 18:39:30 +02:00
LCL: don't set Edit.Modified if change is made during handle creation (bug #2068)
git-svn-id: trunk@10550 -
This commit is contained in:
parent
7751405e34
commit
4296106642
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -2816,6 +2816,12 @@ packager/ucomponentmanmain.pas svneol=native#text/pascal
|
||||
packager/ufrmaddcomponent.lfm svneol=native#text/plain
|
||||
packager/ufrmaddcomponent.lrs svneol=native#text/pascal
|
||||
packager/ufrmaddcomponent.pas svneol=native#text/pascal
|
||||
test/bugs/2068/bug2068.lpi svneol=native#text/plain
|
||||
test/bugs/2068/bug2068.lpr svneol=native#text/plain
|
||||
test/bugs/2068/expected.txt svneol=native#text/plain
|
||||
test/bugs/2068/unit1.lfm svneol=native#text/plain
|
||||
test/bugs/2068/unit1.lrs svneol=native#text/plain
|
||||
test/bugs/2068/unit1.pas svneol=native#text/plain
|
||||
test/bugs/2075/bug2075.lpi svneol=native#text/plain
|
||||
test/bugs/2075/bug2075.lpr svneol=native#text/plain
|
||||
test/bugs/2075/expected.txt svneol=native#text/plain
|
||||
|
@ -411,7 +411,8 @@ Begin
|
||||
if Temp <> Text then Text := Temp;
|
||||
end;
|
||||
|
||||
Modified := True;
|
||||
if not (wcfCreatingHandle in FWinControlFlags) then
|
||||
Modified := True;
|
||||
if HandleAllocated then Change;
|
||||
End;
|
||||
|
||||
|
240
test/bugs/2068/bug2068.lpi
Normal file
240
test/bugs/2068/bug2068.lpi
Normal file
@ -0,0 +1,240 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ActiveEditorIndexAtStart Value="3"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="8">
|
||||
<Unit0>
|
||||
<Filename Value="bug2068.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="bug2068"/>
|
||||
<CursorPos X="28" Y="6"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceFilename Value="unit1.lrs"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<CursorPos X="21" Y="47"/>
|
||||
<TopLine Value="32"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="expected.txt"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<CursorPos X="19" Y="5"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<SyntaxHighlighter Value="None"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\..\lcl\stdctrls.pp"/>
|
||||
<UnitName Value="StdCtrls"/>
|
||||
<CursorPos X="20" Y="631"/>
|
||||
<TopLine Value="606"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<CursorPos X="49" Y="414"/>
|
||||
<TopLine Value="394"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\..\..\lcl\lclclasses.pp"/>
|
||||
<UnitName Value="LCLClasses"/>
|
||||
<CursorPos X="3" Y="32"/>
|
||||
<TopLine Value="12"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\..\lcl\include\spinedit.inc"/>
|
||||
<CursorPos X="3" Y="56"/>
|
||||
<TopLine Value="36"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="..\..\..\lcl\interfaces\carbon\carbonobject.inc"/>
|
||||
<CursorPos X="9" Y="49"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
</Units>
|
||||
<JumpHistory Count="28" HistoryIndex="27">
|
||||
<Position1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="24" Column="16" TopLine="1"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="14" Column="3" TopLine="1"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="16" Column="18" TopLine="1"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="18" Column="78" TopLine="1"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="19" Column="43" TopLine="2"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="20" Column="41" TopLine="9"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="21" Column="44" TopLine="15"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="22" Column="17" TopLine="20"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="bug2068.lpr"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="54" Column="31" TopLine="25"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="8" Column="12" TopLine="1"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="61" Column="29" TopLine="32"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="8" Column="12" TopLine="1"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="bug2068.lpr"/>
|
||||
<Caret Line="6" Column="28" TopLine="1"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="56" Column="16" TopLine="32"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\..\..\lcl\stdctrls.pp"/>
|
||||
<Caret Line="670" Column="39" TopLine="650"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="273" Column="3" TopLine="266"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\..\..\lcl\include\spinedit.inc"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="404" Column="9" TopLine="394"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="273" Column="13" TopLine="253"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="423" Column="27" TopLine="395"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="265" Column="73" TopLine="254"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="415" Column="1" TopLine="395"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="274" Column="1" TopLine="254"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="415" Column="1" TopLine="395"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="274" Column="1" TopLine="254"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="415" Column="1" TopLine="395"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="..\..\..\lcl\include\customedit.inc"/>
|
||||
<Caret Line="402" Column="33" TopLine="394"/>
|
||||
</Position28>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
18
test/bugs/2068/bug2068.lpr
Normal file
18
test/bugs/2068/bug2068.lpr
Normal file
@ -0,0 +1,18 @@
|
||||
program bug2068;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms
|
||||
{ add your units here }, Unit1;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
7
test/bugs/2068/expected.txt
Normal file
7
test/bugs/2068/expected.txt
Normal file
@ -0,0 +1,7 @@
|
||||
FormCreate
|
||||
--> Edit1 is NOT Modified
|
||||
--> Memo1 is NOT Modified
|
||||
FormShow
|
||||
--> Edit1 is NOT Modified
|
||||
--> Memo1 is NOT Modified
|
||||
|
46
test/bugs/2068/unit1.lfm
Normal file
46
test/bugs/2068/unit1.lfm
Normal file
@ -0,0 +1,46 @@
|
||||
object Form1: TForm1
|
||||
Left = 290
|
||||
Height = 300
|
||||
Top = 157
|
||||
Width = 400
|
||||
HorzScrollBar.Page = 399
|
||||
VertScrollBar.Page = 299
|
||||
Caption = 'Form1'
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
object Edit1: TEdit
|
||||
Left = 12
|
||||
Height = 27
|
||||
Top = 13
|
||||
Width = 370
|
||||
OnClick = Memo1Change
|
||||
TabOrder = 0
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 12
|
||||
Height = 70
|
||||
Top = 50
|
||||
Width = 370
|
||||
OnChange = Memo1Change
|
||||
TabOrder = 1
|
||||
end
|
||||
object Debugger: TMemo
|
||||
Left = 12
|
||||
Height = 152
|
||||
Top = 136
|
||||
Width = 370
|
||||
ScrollBars = ssAutoVertical
|
||||
TabOrder = 2
|
||||
end
|
||||
object ApplicationProperties1: TApplicationProperties
|
||||
CaptureExceptions = True
|
||||
HintColor = clInfoBk
|
||||
HintHidePause = 2500
|
||||
HintPause = 500
|
||||
HintShortCuts = True
|
||||
ShowHint = True
|
||||
OnIdle = ApplicationProperties1Idle
|
||||
left = 16
|
||||
top = 264
|
||||
end
|
||||
end
|
16
test/bugs/2068/unit1.lrs
Normal file
16
test/bugs/2068/unit1.lrs
Normal file
@ -0,0 +1,16 @@
|
||||
{ Dit is een automatisch aangemaakt lazarus broncode bestand }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'"'#1#6'Height'#3','#1#3'Top'#3#157#0#5'Wi'
|
||||
+'dth'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.Page'#3'+'#1#7
|
||||
+'Caption'#6#5'Form1'#8'OnCreate'#7#10'FormCreate'#6'OnShow'#7#8'FormShow'#0#5
|
||||
+'TEdit'#5'Edit1'#4'Left'#2#12#6'Height'#2#27#3'Top'#2#13#5'Width'#3'r'#1#7'O'
|
||||
+'nClick'#7#11'Memo1Change'#8'TabOrder'#2#0#0#0#5'TMemo'#5'Memo1'#4'Left'#2#12
|
||||
+#6'Height'#2'F'#3'Top'#2'2'#5'Width'#3'r'#1#8'OnChange'#7#11'Memo1Change'#8
|
||||
+'TabOrder'#2#1#0#0#5'TMemo'#8'Debugger'#4'Left'#2#12#6'Height'#3#152#0#3'Top'
|
||||
+#3#136#0#5'Width'#3'r'#1#10'ScrollBars'#7#14'ssAutoVertical'#8'TabOrder'#2#2
|
||||
+#0#0#22'TApplicationProperties'#22'ApplicationProperties1'#17'CaptureExcepti'
|
||||
+'ons'#9#9'HintColor'#7#8'clInfoBk'#13'HintHidePause'#3#196#9#9'HintPause'#3
|
||||
+#244#1#13'HintShortCuts'#9#8'ShowHint'#9#6'OnIdle'#7#26'ApplicationPropertie'
|
||||
+'s1Idle'#4'left'#2#16#3'top'#3#8#1#0#0#0
|
||||
]);
|
72
test/bugs/2068/unit1.pas
Normal file
72
test/bugs/2068/unit1.pas
Normal file
@ -0,0 +1,72 @@
|
||||
unit Unit1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
ApplicationProperties1: TApplicationProperties;
|
||||
Edit1: TEdit;
|
||||
Memo1: TMemo;
|
||||
Debugger: TMemo;
|
||||
procedure ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Memo1Change(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.ApplicationProperties1Idle(Sender: TObject; var Done: Boolean);
|
||||
begin
|
||||
if ParamStr(1)='--runtest' then begin
|
||||
writeln(Debugger.Text);
|
||||
Close;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
debugger.lines.add('FormCreate');
|
||||
if edit1.Modified then debugger.Lines.Add(' --> Edit1 is Modified') else
|
||||
debugger.Lines.Add(' --> Edit1 is NOT Modified');
|
||||
if memo1.Modified then debugger.Lines.Add(' --> Memo1 is Modified') else
|
||||
debugger.Lines.Add(' --> Memo1 is NOT Modified');
|
||||
end;
|
||||
|
||||
procedure TForm1.FormShow(Sender: TObject);
|
||||
begin
|
||||
debugger.lines.add('FormShow');
|
||||
if edit1.Modified then debugger.Lines.Add(' --> Edit1 is Modified') else
|
||||
debugger.Lines.Add(' --> Edit1 is NOT Modified');
|
||||
if memo1.Modified then debugger.Lines.Add(' --> Memo1 is Modified') else
|
||||
debugger.Lines.Add(' --> Memo1 is NOT Modified');
|
||||
end;
|
||||
|
||||
procedure TForm1.Memo1Change(Sender: TObject);
|
||||
begin
|
||||
debugger.lines.add(
|
||||
Format('-- Memo1Change is fired: Sender = %s',[(Sender as TComponent).Name]))
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I unit1.lrs}
|
||||
|
||||
end.
|
||||
|
@ -57,7 +57,7 @@ begin
|
||||
BufferedOutput.SetSize(BytesRead + READ_BYTES);
|
||||
|
||||
// try reading it
|
||||
if AProcess.NumBytesAvailable>0 then begin
|
||||
if AProcess.Output.NumBytesAvailable>0 then begin
|
||||
n := AProcess.Output.Read((BufferedOutput.Memory + BytesRead)^, READ_BYTES);
|
||||
Inc(BytesRead, n)
|
||||
end
|
||||
@ -70,7 +70,7 @@ begin
|
||||
// make sure we have room
|
||||
BufferedOutput.SetSize(BytesRead + READ_BYTES);
|
||||
// try reading it
|
||||
if AProcess.NumBytesAvailable>0 then begin
|
||||
if AProcess.Output.NumBytesAvailable>0 then begin
|
||||
n := AProcess.Output.Read((BufferedOutput.Memory + BytesRead)^, READ_BYTES);
|
||||
Inc(BytesRead, n);
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user