mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-05 00:53:00 +02:00
Fixed an issue with wrapping new objects into tl::Variants which are returned directly. For these objects, ownership needs to be transferred to the script.
This commit is contained in:
+11
-1
@@ -2460,8 +2460,18 @@ void Variant::user_destroy ()
|
||||
void *obj = to_user ();
|
||||
if (obj) {
|
||||
user_cls ()->destroy (obj);
|
||||
m_type = t_nil;
|
||||
}
|
||||
reset ();
|
||||
}
|
||||
|
||||
void *Variant::user_take ()
|
||||
{
|
||||
tl_assert (is_user ());
|
||||
void *obj = to_user ();
|
||||
if (obj) {
|
||||
m_type = t_nil;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
void Variant::user_assign (const tl::Variant &other)
|
||||
|
||||
@@ -861,6 +861,11 @@ public:
|
||||
*/
|
||||
void user_destroy ();
|
||||
|
||||
/**
|
||||
* @brief Takes the user object and releases it from the variant
|
||||
*/
|
||||
void *user_take ();
|
||||
|
||||
/**
|
||||
* @brief Assigns the object stored in other to self
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user