:Disable() doesn't remove map icons (fix/workaround included) #85


Closed
  • tw_vincent created this issue Aug 20, 2018

    The :Diable() call triggers :OnDisable() which should remove map icons; however, the dataprovider is not being removed from the WorldMapFrame so the icons remain on the map -- this is a problem

     

    Note that MapCanvas_DataProviderBase performs an assert() when providers are removed so if HandyNotes initializes in enabled=false, this assert will fail and an error will be thrown, so it should only be called when a dataprovider has, in fact, been added.

     

    HandyNotes:OnEnable()

    	WorldMapFrame:AddDataProvider(HandyNotes.WorldMapDataProvider)
    	self.WorldMapHasDataProvider = true -- This flag lets HandyNotes it is safe to call :RemoveDataProvider()
    

     HandyNotes:OnDisable()

    	if self.WorldMapHasDataProvider then -- only attempt to remove if a provider has been given
    		WorldMapFrame:RemoveDataProvider(HandyNotes.WorldMapDataProvider) 
    	end
    	self.WorldMapHasDataProvider = false

     

    HandyNotes loads both Enabled and Disabled without error and the map icons are properly removed with :Disable()

  • nevcairiel closed issue Jan 24, 2019

To post a comment, please login or register a new account.