Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello β I'm @olemoritz on Twitter.
Odd Crash Report
-
Report said:
The app was terminated due to an Objective-C exception. Details below:
2020-04-30 08:45:32.339467
-[UIImageView _resolveAndDiscard]: unrecognized selector sent to instance 0x157fb5be0Has anyone generated this while using
scene
module? i cant think of how an unrecognized selector would be sent when im not manually sending objc selectors... -
@stephen, how are you using UIImageView in scene? Maybe there is some clue there.
How consistent is this crash?
Also, I think you were aware of the crashiness of
load_from_url
, so you are probably not using it? -
@mikael said:
@stephen, how are you using UIImageView in scene? Maybe there is some clue there.
How consistent is this crash?
Also, I think you were aware of the crashiness of
load_from_url
, so you are probably not using it?this is why its so odd.. π¬π§π€ im not using UIImageView. also nt using `load_from_url. the crash was pretty consistent, would crash about every 5 time i would us Run.. but whats even more odd is once i commented out some code that handled a pond for my game it sems to have stopped.. ill post the code.. but it probably wont run or u without everything and assets.. but ill show what i was alling how and that its all fom scene (i know scene use ui but i figured id need to exclusivly call UIImageView to get this issue)
class GameController: eBoxes = [] nodes= [] main = None pointer = None @classmethod def update(cls, dt): for eBox in cls.eBoxes: eBox.update(dt) @classmethod def touch_began(cls, touch): cls.pointer.touch_began(touch) for n in cls.nodes: if n.point_from_scene(touch.location) in n.frame: cls.main.update_selected(n) @classmethod def touch_moved(cls, touch): cls.pointer.touch_moved(touch) @classmethod def touch_ended(cls, touch): cls.pointer.touch_ended(touch) class Pond(SpriteNode): def __init__(self, p, *args, **kwargs): self.texture = Texture('./desert/desert-pond-top.png') self.position = Point(200, 60) SpriteNode.__init__(self, texture = self.texture, position = self.position, parent = p, *args, **kwargs) self.fishingSpots=[ Point(-350, 100), Point(50, -200), Point(50, 225), Point(325, 100)] self.fishingNodes=[ FishingSpotBrush(self, [], position=Point(0, 0)), FishingSpotBrush(self, [], position=Point(0, 0))] for brush in self.fishingNodes: from random import choice x, y = choice(self.fishingSpots) brush.run_action(Action.move_to(x, y, 5)) self.Animate() def Animate(self): scale = move = alpha=[] r = rx = ry = 0 for x in range(100): r=random.random() inRange = 0.80 < r < 1 if inRange: scale.append(a.scale_to(r + 0.10, 5, TIMING_SINODIAL)) alpha.append(a.fade_to(r - 0.10, 5, TIMING_SINODIAL)) rx, ry=random.randrange(5, 30), random.randrange(5, 10) move.append(a.move_by(rx, ry, 5, TIMING_SINODIAL)) move.append(a.move_by(-rx, -ry, 5, TIMING_SINODIAL)) self.run_action( a.repeat( a.group( a.sequence(scale), a.sequence(move)), -1)) class DevMapDesert(SpriteNode): def __init__(self, p, *args, **kwargs): self.texture = Texture('./desert/desert-testing.png') self.size = Size(4096, 4096) SpriteNode.__init__(self, texture = self.texture, size =vself.size, parent = p, *args, **kwargs) self.pondWater=Pond(self) def update(self, dt): class GO(SpriteNode): def __init__(self, texture='clear.png', name='', hidden=False, *args, **kwargs): self.texture=Texture(texture) self.name=name SpriteNode.__init__(self, texture=self.texture, *args, **kwargs) self._hidden=hidden GameController.nodes.append(self) EventBox(controller=GameController, parent=self.scene, target=self) @property def hidden(self): return self._hidden @hidden.setter def hidden(self, boolean): self._hidden = boolean if self._hidden: self.alpha = 1.0 else: self.alpha = 0.0 def select(self): pass def deselect(self): pass class BaseSkillNode(GO): def __init__(self, skill, refItems, *args, **kwargs): self.skill=skill self.refItems=refItems self.maxItems=3 self.items=list([]) self.refill_timer=30 self.refill_t=0.0 self.travel_timer=120 self.skill_level_req=0 self.main_level_req=0 self.equipment_req=None self.has_items_texture=None self.empty_texture=None self.items_full_texture=None self.gameObjects=[] self.anim_present=None self.anim_idle=None self.anim_move=None self.anim_gathering=None self.anim_gather_failed=None self.anim_gather_success=None self.anim_dismissed=None GO.__init__(self, *args, **kwargs) def Dismiss(self): pass def Present(self): pass def AddItem(self): if len(self.items) == 0: pass print('Added Item') def update(self, dt): if self.refill_timer != None: self.refill_t += dt if self.refill_t >= self.refill_timer: self.AddItem() self.refill_t = 0 if self.travel_timer > 0: self.travel_timer -= dt if self.travel_timer <= 0: self.remove_all_actions() self.run_action(self.anim_move()) class FishingSpotBrush(BaseSkillNode): def __init__(self, caller, skill=Skills.Fishing, refItems=[], *args, **kwargs): BaseSkillNode.__init__(self, skill = skill, refItems = refItems, parent = caller, name = 'Fishing Spot', *args, **kwargs) self.anim_idle = Animations.Fishing_Spot_Idle self.anim_move = Animations.Fishing_Spot_Move self.anim_dismissed = Animations.Fishing_Spot_Dismissed self.gameObjects.append(SpriteNode( texture = Texture('fishing-spot-idle.png'), parent = self, color = '#ffd1d1')) self.gameObjects.append(SpriteNode( texture = Texture('fishing-spot-idle.png'), parent = self, color = '#f3faff')) for go in self.gameObjects: self.anim_idle(go) class main(Scene): def setup(self): self.map=Desert(parent=self) self.UIPlayer=PlayerSprite(self) self.dir=0 Pointer(self) self.FootSpeed=40 GameController.main=self self.selected=None self.hud_test=Text( pos=Point(self.size[0]/2, self.size[1]), title=f'Focus', text='None..', parent=self) def update_selected(self, node): node.add_child( SpriteNode( Texture('spc:Fire15'), position=node.position)) if self.selected != None: self.selected.deselect() self.selected=None self.selected = node node.select() self.hud_test.update_text(f'{node.name}') def did_change_size(self): pass def did_evaluate_actions(self): pass def update(self): GameController.update(self.dt) self.map.update(self, self.dt) def move(self, target): loc=target loc=Point((loc[0]-self.size[0]/2)*-1, (loc[1]-self.size[1]/2)*-1) dur=Dist(self.UIPlayer.position, target) self.map.run_action(a.repeat(a.move_by(loc[0]*self.FootSpeed*self.dt, loc[1]*self.FootSpeed*self.dt, 1), -1), 'pMoving') def touch_began(self, touch): self.move(touch.location) GameController.touch_began(touch) self.UIPlayer.rotation=LookAt(self.UIPlayer.position, touch.location) def touch_moved(self, touch): self.move(touch.location) GameController.touch_moved(touch) self.UIPlayer.rotation=LookAt(self.UIPlayer.position, touch.location) def touch_ended(self, touch): GameController.touch_ended(touch) self.map.run_action(a.move_by(0, 0, 0.1), 'pMoving') if __name__=='__main__': run(main(), show_fps=True)
I believe that is everything that would be used with pond for now. Any Ideas?
.
-
Can you install @dgelessus 's faulthandler, then reproduce the crash? That will show the full stacktrace at least.
Which code commented out fixes the crash?
I have seen some strange unrecognized selectors when something gets totally borked, maybe some memory got overwritten.
-
@JonB said:
Can you install @dgelessus 's faulthandler, then reproduce the crash? That will show the full stacktrace at least.
Which code commented out fixes the crash?
I have seen some strange unrecognized selectors when something gets totally borked, maybe some memory got overwritten.
sorry for the weird commenting lol i just coppied from script
yea i will give FaultHandler a try Thank You!
###############BEGIN DEBUG BLOCK############### #FIXME: TESTING.. ##class Pond(SpriteNode): ## def __init__(self, p, *args, **kwargs): ## self.texture = Texture('./desert/desert-pond-top.png') ## self.position=Point(200, 60) ## SpriteNode.__init__(self, ## texture=self.texture, ## position=self.position, ## parent=p, *args, **kwargs) ## self.fishingSpots=[ ## Point(-350, 100), ## Point(50, -200), ## Point(50, 225), ## Point(325, 100)] ## self.fishingNodes=[] ## ## FishingSpotBrush(self, [], position=Point(0, 0)),#self.fishingSpots[0]), ## FishingSpotBrush(self, [], position=Point(0, 0))]#self.fishingSpots[1])] ## for brush in self.fishingNodes: ## import random ## x, y=random.choice(self.fishingSpots) ## brush.run_action(Action.move_to(x, y, 5)) ## ## ## ## self.Animate() ## def Animate(self): ## scale = move = alpha=[] ## r = rx = ry = 0 ## for x in range(100): ## r=random.random() ## inRange = 0.80 < r < 1 ## if inRange: ## scale.append(a.scale_to(r+.10, 5, TIMING_SINODIAL)) ## alpha.append(a.fade_to(r-.10, 5, TIMING_SINODIAL)) ## rx, ry=random.randrange(5, 30), random.randrange(5, 10) ## move.append(a.move_by(rx, ry, 5, TIMING_SINODIAL)) ## move.append(a.move_by(-rx, -ry, 5, TIMING_SINODIAL)) ## self.run_action( ## a.repeat( ## a.group( ## a.sequence(scale), ## a.sequence(move)), -1)) ## ##class DevMapDesert(SpriteNode): ## def __init__(self, p, *args, **kwargs): ## self.texture = Texture('./desert/desert-testing.png') ## self.size=Size(4096, 4096) ## SpriteNode.__init__(self, ## texture=self.texture, ## size=self.size, ## parent=p, *args, **kwargs) ## self.pondWater=Pond(self) ## def update(self, dt): ## pass ## ###############END DEBUG BLOCK###############
-
Try commenting out the self.Animate. I wonder if the repeat forever could be a problem, say if there was a memory leak somewhere.
-
@JonB Good Idea!
-
@JonB i cannot seem to find FaultHandler
-
@JonB @mikael I believe i found the one issue.
r1= SpriteNode( Texture(ui.Image.named('./assets/player-ring1.png')), position=p.size/2, scale=0.5, speed=2, alpha=0, parent=main) r2= SpriteNode( Texture(ui.Image.named('./assets/player-ring2.png')), position=p.size/2, scale=0.5, speed=2, alpha=0, parent=main)
i think
Texture(ui.Image.named('./assets/player-ring1.png')),
is whats crashing but i agree on the memory leak. so im going to go over every object and see if i can find what hanging up.. -
-
@cvp ... guess who looked right at it earlier and didmt see it... ππΌπ€¦π»ββοΈ
-
@stephen said:
for brush in self.fishingNodes:
from random import choice
x, y = choice(self.fishingSpots)
brush.run_action(Action.move_to(x, y, 5))self.Animate() def Animate(self): scale = move = alpha=[] r = rx = ry = 0 for x in range(100):
@stephen, I'm confused by the indentation and code sequence in this region of class Pond. Maybe the problem is here?
-
@njm i see lol this was a section that was commented out by another script i been working on and the uncomment function is still buggy. normally that code is like the following. otherwise the script wouldnt run at all
for brush in self.fishingNodes: from random import choice x, y = choice(self.fishingSpots) brush.run_action(Action.move_to(x, y, 5)) self.Animate() def Animate(self): scale = move = alpha=[] r = rx = ry = 0 for x in range(100):
-
@JonB @mikael @cvp @njm turned out he
ui.Image
calls insideTexture
combined with two corrupted images was the problem. when i removed theui.Image
calls i still crashed but with no stack report at all then i somehow came across twopng
files the were101b
in size instead of the1.1MB
lol no more crashes. thanks for all the help everyone! -
@stephen π