mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-23 11:47:24 +01:00
* FWObject.cpp (insert_before): see #2171 "Undoing delete of rule
ends up with rules being created with duplicate rule numbers". Also see #2172 "Crash when deleting rule - related to #2171". When user deleted the last rule in a rule set, then used Undo to restore it, the program lost track of rules in the rule set and became unstable.
This commit is contained in:
parent
f6f28b983c
commit
327183c1f2
@ -1,5 +1,12 @@
|
||||
2011-04-01 vadim <vadim@netcitadel.com>
|
||||
|
||||
* FWObject.cpp (insert_before): see #2171 "Undoing delete of rule
|
||||
ends up with rules being created with duplicate rule
|
||||
numbers". Also see #2172 "Crash when deleting rule - related to
|
||||
#2171". When user deleted the last rule in a rule set, then used
|
||||
Undo to restore it, the program lost track of rules in the rule
|
||||
set and became unstable.
|
||||
|
||||
* FWObject.cpp (shallowDuplicate): see #2286 "Crash when closing
|
||||
file". The GUI crashed if user imported iptables or pix
|
||||
configuration, then deleted a rule and tried to close project
|
||||
|
||||
@ -854,11 +854,17 @@ void FWObject::insert_before(FWObject *o1, FWObject *obj)
|
||||
{
|
||||
checkReadOnly();
|
||||
|
||||
if(!obj)
|
||||
if (obj == NULL) return;
|
||||
if (o1 == NULL)
|
||||
{
|
||||
insert(begin(), obj);
|
||||
_adopt(obj);
|
||||
setDirty(true);
|
||||
return;
|
||||
|
||||
list<FWObject*>::iterator m=find(begin(),end(),o1);
|
||||
if(m!=end())
|
||||
}
|
||||
|
||||
list<FWObject*>::iterator m = find(begin(), end(), o1);
|
||||
if (m != end())
|
||||
{
|
||||
insert(m, obj);
|
||||
_adopt(obj);
|
||||
@ -870,13 +876,12 @@ void FWObject::insert_after(FWObject *o1, FWObject *obj)
|
||||
{
|
||||
checkReadOnly();
|
||||
|
||||
if(!obj)
|
||||
return;
|
||||
if (obj == NULL) return;
|
||||
|
||||
list<FWObject*>::iterator m=find(begin(),end(),o1);
|
||||
if(m!=end())
|
||||
list<FWObject*>::iterator m = find(begin(), end(), o1);
|
||||
if (m != end())
|
||||
{
|
||||
insert(++m,obj);
|
||||
insert(++m, obj);
|
||||
_adopt(obj);
|
||||
setDirty(true);
|
||||
}
|
||||
|
||||
@ -1059,7 +1059,14 @@ QString FWObjectPropertiesFactory::getRuleActionPropertiesRich(Rule *rule)
|
||||
{
|
||||
FWObject *p=rule;
|
||||
while (p!=NULL && !Firewall::cast(p)) p=p->getParent();
|
||||
assert(p!=NULL);
|
||||
if (p==NULL)
|
||||
{
|
||||
qDebug() << "FWObjectPropertiesFactory::getRuleActionPropertiesRich(): "
|
||||
<< "Can not locate parent firewall for the rule:";
|
||||
rule->dump(false, true);
|
||||
return "";
|
||||
}
|
||||
|
||||
string platform=p->getStr("platform");
|
||||
QString act = getActionNameForPlatform(Firewall::cast(p), rule);
|
||||
QString par = getRuleActionProperties(rule);
|
||||
|
||||
@ -631,7 +631,9 @@ void RuleSetModel::restoreRules(QList<Rule*> rules, bool topLevel)
|
||||
{
|
||||
Rule* rule = rules.first();
|
||||
pivotRule = ruleset->getRuleByNum(0);
|
||||
|
||||
ruleset->insert_before(pivotRule, rule);
|
||||
|
||||
pivotIndex = index(pivotRule, 0);
|
||||
|
||||
if (topLevel && pivotIndex.parent().isValid())
|
||||
|
||||
@ -187,17 +187,23 @@ bool isUsingNetZone(Firewall *fw)
|
||||
|
||||
bool isDefaultPolicyRuleOptions(FWOptions *opt)
|
||||
{
|
||||
bool res=true;
|
||||
bool res = true;
|
||||
FWObject *p;
|
||||
PolicyRule *rule = NULL;
|
||||
|
||||
p=opt;
|
||||
p = opt;
|
||||
do {
|
||||
p=p->getParent();
|
||||
p = p->getParent();
|
||||
if (PolicyRule::cast(p)!=NULL) rule = PolicyRule::cast(p);
|
||||
} while ( p!=NULL && Firewall::cast(p)==NULL );
|
||||
|
||||
assert(p!=NULL);
|
||||
if (p==NULL)
|
||||
{
|
||||
qDebug() << "isDefaultPolicyRuleOptions()"
|
||||
<< "Can not locate parent Firewall object for the options object";
|
||||
opt->dump(false, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
QString platform = p->getStr("platform").c_str();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user