Bug in FormulaDelegate : string copy was made in a wrong way
This commit is contained in:
		@@ -1,9 +1,11 @@
 | 
			
		||||
v0.7 (11/11/2016)
 | 
			
		||||
v0.7 (01/01/2017)
 | 
			
		||||
** User **
 | 
			
		||||
	Set background calendar color to red or yellow when one account is negative or less than 200
 | 
			
		||||
	Set background calendar color to red or yellow when one account is negative or less than 200€
 | 
			
		||||
 | 
			
		||||
** Dev **
 | 
			
		||||
** Bugs **
 | 
			
		||||
	Bug in expression parser, negative mark before parenthesis considered as positive.
 | 
			
		||||
	Bug in FormulaDelegate : string copy was made in a wrong way
 | 
			
		||||
 | 
			
		||||
v0.6 (08/10/2016)
 | 
			
		||||
** User **
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@
 | 
			
		||||
#include "FormulaDelegate.hpp"
 | 
			
		||||
#include <ParseExp.hpp>
 | 
			
		||||
#include "../wxUI.hpp"
 | 
			
		||||
#include <cstring>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
QWidget * FormulaDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const
 | 
			
		||||
@@ -38,17 +39,17 @@ void FormulaDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
 | 
			
		||||
    double res = 0.0;
 | 
			
		||||
    QString value = line->text();
 | 
			
		||||
    struct ParseExp::parse_opt opt, *r;
 | 
			
		||||
    const char* c;
 | 
			
		||||
    char* str, *str2;
 | 
			
		||||
    bool ok;
 | 
			
		||||
 | 
			
		||||
    std::string ss;
 | 
			
		||||
    
 | 
			
		||||
    value = value.trimmed();
 | 
			
		||||
    if (value.startsWith("="))
 | 
			
		||||
    {
 | 
			
		||||
	value = value.replace(",", ".");
 | 
			
		||||
	c = value.toStdString().c_str();
 | 
			
		||||
	str2 = str = new char[strlen(c)];
 | 
			
		||||
	strcpy(str, c+1);
 | 
			
		||||
	ss = value.toStdString();
 | 
			
		||||
	str2 = str = new char[ss.length()];
 | 
			
		||||
	std::strcpy(str, ss.c_str()+1);
 | 
			
		||||
	memset(&opt, 0, sizeof(opt));
 | 
			
		||||
	r = &opt;
 | 
			
		||||
	try {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user