@yuneta/gobj-js 7.26.28 → 7.26.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2150,7 +2150,8 @@ function gobj_play(gobj) {
2150
2150
  if (!gobj_is_running(gobj)) {
2151
2151
  if (!(gobj.gclass.gclass_flag & gclass_flag_t.gcflag_required_start_to_play)) {
2152
2152
  log_warning(`${gobj_short_name(gobj)}: GObj playing without previous start`);
2153
- gobj_start(gobj);
2153
+ if (start_destroys_it(gobj)) return -1;
2154
+ if (!gobj.running) return -1;
2154
2155
  } else {
2155
2156
  log_error(`${gobj_short_name(gobj)}: Cannot play, start not done`);
2156
2157
  return -1;
@@ -2975,12 +2976,20 @@ function gobj_current_state(gobj) {
2975
2976
  function gobj_change_parent(gobj, parent) {
2976
2977
  if (gobj_is_destroying(gobj)) {
2977
2978
  log_error("gobj NULL or DESTROYED");
2978
- return null;
2979
+ return -1;
2979
2980
  }
2980
2981
  if (!(parent instanceof GObj)) {
2981
2982
  log_error(`${gobj_short_name(gobj)}: gobj_change_parent() BAD TYPE of parent`);
2982
2983
  return -1;
2983
2984
  }
2985
+ if (gobj_is_destroying(parent)) {
2986
+ log_error(`${gobj_short_name(gobj)}: gobj_change_parent() parent NULL or DESTROYED`);
2987
+ return -1;
2988
+ }
2989
+ for (let p = parent; p; p = p.parent) if (p === gobj) {
2990
+ log_error(`${gobj_short_name(gobj)}: gobj_change_parent() a gobj cannot be its own ancestor: ${gobj_short_name(parent)}`);
2991
+ return -1;
2992
+ }
2984
2993
  if (gobj.parent && gobj.parent.gclass.gmt.mt_child_removed) gobj.parent.gclass.gmt.mt_child_removed(gobj.parent, gobj);
2985
2994
  if (gobj.parent) {
2986
2995
  _remove_child(gobj.parent, gobj);
@@ -7457,9 +7466,11 @@ function new_uuid() {
7457
7466
  * identity card and the `host` of every message the client sends, so
7458
7467
  * the first answer is kept and answered again: 7.26.27 made a new
7459
7468
  * uuid on every call when the store could not keep it, and answered
7460
- * null without crypto.randomUUID().
7469
+ * null without crypto.randomUUID(). A stored value that is not a
7470
+ * uuid (a foreign or corrupt write) is replaced, with a WARNING.
7461
7471
  ************************************************************/
7462
7472
  var uuid_of_this_page = null;
7473
+ var UUID_SHAPE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7463
7474
  function node_uuid() {
7464
7475
  if (uuid_of_this_page) return uuid_of_this_page;
7465
7476
  const store = local_store();
@@ -7475,6 +7486,10 @@ function node_uuid() {
7475
7486
  uuid_of_this_page = new_uuid();
7476
7487
  return uuid_of_this_page;
7477
7488
  }
7489
+ if (uuid && !UUID_SHAPE.test(uuid)) {
7490
+ log_warning("node_uuid(): the stored host_uuid is not a uuid: a new one replaces it");
7491
+ uuid = null;
7492
+ }
7478
7493
  if (!uuid) {
7479
7494
  uuid = new_uuid();
7480
7495
  try {