Core: Fixed Value::operator= cornercase

git-svn-id: svn://ultimatepp.org/upp/trunk@7908 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-11-19 14:43:43 +00:00
parent cbc9c8b04a
commit 810d9b670e
3 changed files with 42 additions and 23 deletions

View file

@ -33,8 +33,9 @@ void Value::RefRetain()
Value& Value::operator=(const Value& v) {
if(this == &v) return *this;
FreeRef();
data = v.data;
Value h = v; // Make copy a 'v' can be reference to ValueMap/Array contained element
FreeRef(); // e.g. json = json["foo"]
data = h.data;
if(IsRef())
ptr()->Retain();
return *this;

View file

@ -19,21 +19,7 @@ paragraphs (wraps them).&]
[s0; &]
[s2;
@@image:875&475
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>西<EFBFBD>ǘ<EFBFBD>
<EFBFBD><EFBFBD>п<EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD>
妿<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>ж<EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(A4wATAAAALT/AAAAAHic7V1bjtswDMyJ9x49Qm/Qj6JXdIF+GIrmIcqWbW7DgREkEjkiOZISawHv148/X3Wlv7ZCYpRG+VEa5UdplB+dRq937I2dF7bEe78dlqRzhoSuo44wf83jER7OxczYM4iwlU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mqkTl8QKPgRFprTINfjgefp4qWymtW6NJoe8/IFND3oqXKnZJQF7NHdfZxY+qrCnIFvuk5w8KaDKluWCken6kRXYYXjXUerUa/f/2sK9WFGhVyojTKj9IoP0qj/CiN8qM0yo+vp//Fc12R6y/AZWMf)
&]
[s0; &]
[s0; [/ Derived from] [^topic`:`/`/CtrlLib`/src`/TextCtrl`$en`-us`#TextCtrl`:`:class^ Tex
@ -47,6 +33,12 @@ ont]_[*@3 f])&]
[s2; Sets the font to be used by widget to [%-*@3 f].&]
[s3; &]
[s4;%- &]
[s5;:DocEdit`:`:After`(int`):%- [_^DocEdit^ DocEdit][@(0.0.255) `&]_[* After]([@(0.0.255) int
]_[*@3 a])&]
[s2; The height of empty block after the paragraph in pixels. Default
is 0.&]
[s3; &]
[s4;%- &]
[s5;:DocEdit`:`:SetFilter`(int`(`*`)`(int c`)`):%- [_^DocEdit^ DocEdit][@(0.0.255) `&]_[* S
etFilter]([@(0.0.255) int]_(`*[*@3 f])([@(0.0.255) int]_c))&]
[s2; [%- Sets the character filter] [%-*@3 f]. All characters keystrokes
@ -61,6 +53,11 @@ ool]_[*@3 b]_`=_[@(0.0.255) true])&]
is active by default.&]
[s3; &]
[s4;%- &]
[s5;:DocEdit`:`:IsAutoHideSb`(`)const:%- [@(0.0.255) bool]_[* IsAutoHideSb]()_[@(0.0.255) c
onst]&]
[s2; Returns true if AutoHideSb is active.&]
[s3;%- &]
[s4;%- &]
[s5;:DocEdit`:`:UpDownLeave`(bool`):%- [_^DocEdit^ DocEdit][@(0.0.255) `&]_[* UpDownLeave](
[@(0.0.255) bool]_[*@3 u]_`=_[@(0.0.255) true])&]
[s2; In UpDownLeave mode, Up key at the top of text or Down key at
@ -78,4 +75,24 @@ the focus to previous / next Ctrl that IsWantFocus.&]
onst]&]
[s2; Tests UpDownLeave mode.&]
[s3; &]
[s0; ]
[s4;%- &]
[s5;:DocEdit`:`:SetScrollBarStyle`(const ScrollBar`:`:Style`&`):%- [_^DocEdit^ DocEdit][@(0.0.255) `&
]_[* SetScrollBarStyle]([@(0.0.255) const]_[_^ScrollBar`:`:Style^ ScrollBar`::Style][@(0.0.255) `&
]_[*@3 s])&]
[s2; Sets the chameleon style of scrollbar.&]
[s3; &]
[s4;%- &]
[s5;:DocEdit`:`:EofLine`(bool`):%- [_^DocEdit^ DocEdit][@(0.0.255) `&]_[* EofLine]([@(0.0.255) b
ool]_[*@3 b]_`=_[@(0.0.255) true])&]
[s2; If active, paints faint line at the end of text. Default is
active.&]
[s3; &]
[s4;%- &]
[s5;:DocEdit`:`:NoEofLine`(`):%- [_^DocEdit^ DocEdit][@(0.0.255) `&]_[* NoEofLine]()&]
[s2; Same as EofFile(false).&]
[s3;%- &]
[s4;%- &]
[s5;:DocEdit`:`:IsEofLine`(`)const:%- [@(0.0.255) bool]_[* IsEofLine]()_[@(0.0.255) const]&]
[s2; Returns true if EofLine is active.&]
[s3;%- &]
[s0; ]]

View file

@ -512,12 +512,13 @@ bool PostgreSQLConnection::Execute()
if(*s == '\'' || *s == '\"')
s = PostgreSQLReadString(s, query);
else {
if(pi >= param.GetCount()) {
session->SetError("Invalid number of parameters", statement);
return false;
}
if(*s == '?')
if(*s == '?') {
if(pi >= param.GetCount()) {
session.SetError("Invalid number of parameters", statement);
return false;
}
query.Cat(param[pi++]);
}
else
query.Cat(*s);
s++;