HISE Logo Forum
    • Categories
    • Register
    • Login

    [SOLVED] Why is this causing a leak detection when closing the exported app?

    Scheduled Pinned Locked Moved General Questions
    leakownedarray
    2 Posts 1 Posters 189 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk
      last edited by ustk

      To make it short, I check if the pref file is present, if yes -> load it, if not -> create it, check again and load
      Does this count as a cyclic ref?
      The exception is thrown only when closing the app

      const var prefFile = FileSystem.getFolder(FileSystem.AppData).getChildFile("pref.sfts");
      
      inline function load()
      {
      	if (prefFile.isFile())
      	{
      		local decryptedPrefFile = prefFile.loadEncryptedObject(PREF_FILE_PIN);
      		
      		if (isDefined(decryptedPrefFile.showInfo))
      		{
      			// whatever
      		}
      	}
      	else
      		create();
      }
      load();
      
      
      inline function create()
      {
      	prefFile.writeEncryptedObject(preferences, PREF_FILE_PIN);
      	load(); // <= good or bad?
      }
      

      Can't help pressing F5 in the forum...

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @ustk
        last edited by

        @ustk Sometimes I just think too much...
        Or not enough! 🤣

        inline function load()
        {
        	if (!prefFile.isFile())
        		prefFile.writeEncryptedObject(preferences, PREF_FILE_PIN);
        	
        	local decryptedPrefFile = prefFile.loadEncryptedObject(PREF_FILE_PIN);
        	
        	if (isDefined(decryptedPrefFile.showInfo))
        	{
        		// whatever
        	}
        }
        load();
        

        Can't help pressing F5 in the forum...

        1 Reply Last reply Reply Quote 3
        • First post
          Last post

        18

        Online

        1.8k

        Users

        11.9k

        Topics

        104.0k

        Posts