File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -1114,12 +1114,14 @@ namespace Sass {
1114
1114
// Implement delayed value fetcher
1115
1115
// ///////////////////////////////////////////////////////////////////////
1116
1116
1117
+ // The original value may not be returned
1118
+ // Therefore make sure original is collected
1117
1119
Value* Number::withoutSlash ()
1118
1120
{
1119
1121
if (!hasAsSlash ()) return this ;
1120
1122
// we are the only holder of this item
1121
1123
// therefore should be safe to alter it
1122
- if (this ->refcount = = 1 ) {
1124
+ if (this ->refcount < = 1 ) {
1123
1125
lhsAsSlash_.clear ();
1124
1126
rhsAsSlash_.clear ();
1125
1127
return this ;
Original file line number Diff line number Diff line change @@ -83,15 +83,18 @@ namespace Sass {
83
83
// ///////////////////////////////////////////////////////////////////////
84
84
// ///////////////////////////////////////////////////////////////////////
85
85
86
- Value* Eval::withoutSlash (Value* value) {
86
+ Value* Eval::withoutSlash (ValueObj value) {
87
+ if (value == nullptr ) return value;
87
88
Number* number = value->isaNumber ();
88
89
if (number && number->hasAsSlash ()) {
89
90
logger.addDeprecation (" Using / for division is deprecated and will be removed "
90
91
" in LibSass 4.1.0.\n\n Recommendation: math.div(" + number->lhsAsSlash ()->inspect () +
91
92
" , " + number->rhsAsSlash ()->inspect () + " )\n\n More info and automated migrator: "
92
93
" https://sass-lang.com/d/slash-div" , value->pstate ());
93
94
}
94
- return value->withoutSlash ();
95
+ // Make sure to collect all memory
96
+ ValueObj result = value->withoutSlash ();
97
+ return result.detach ();
95
98
}
96
99
97
100
// ///////////////////////////////////////////////////////////////////////
@@ -284,7 +287,7 @@ namespace Sass {
284
287
285
288
}
286
289
287
- for (auto & arg : positional) {
290
+ for (ValueObj & arg : positional) {
288
291
arg = withoutSlash (arg);
289
292
}
290
293
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ namespace Sass {
28
28
void exposeFwdRule (ForwardRule* rule);
29
29
void exposeImpRule (IncludeImport* rule);
30
30
31
- Value* withoutSlash (Value* value);
31
+ Value* withoutSlash (ValueObj value);
32
32
33
33
// Some references
34
34
Logger& logger;
You can’t perform that action at this time.
0 commit comments