1. Chris Klimas
  2. zoetrope

Commits

Chris Klimas  committed 087a81c

Fix quitting from breakpoint

  • Participants
  • Parent commits 1b5939f
  • Branches default

Comments (0)

Files changed (2)

File zoetrope/debug/debugger.lua

View file
  • Ignore whitespace
 --		forever - run indefinitely, or just for a single frame?
 --
 -- Returns:
---		nothing
+--		whether a quit event was detected, and the caller
+--		should take an action based on this
 
 debugger._miniEventLoop = function (forever)
 	local elapsed = 0
+	local quitNow = false
 
 	repeat
 		if love.event then
 			
 			for e, a, b, c, d in love.event.poll() do
 				if e == 'quit' then
-					if not love.quit or not love.quit() then return end
+					if not love.quit or not love.quit() then
+						quitNow = true
+						forever = false
+					end
 				end
 
 				love.handlers[e](a, b, c, d)
 		debugger.console:endFrame(elapsed)
 
 		if the.keys:pressed('escape') then
-			if not love.quit or not love.quit() then return end
+			if not love.quit or not love.quit() then
+				love.event.quit()
+			end
 		end
 
 		if love.graphics then
 		if love.timer then love.timer.sleep(0.03) end
 		if love.graphics then love.graphics.present() end
 	until not forever 
+
+	return quitNow
 end

File zoetrope/debug/stepper.lua

View file
  • Ignore whitespace
 			self:showLine(file, line)
 
 			debugger._stepPaused = true
+			local quit = false
 
-			while debugger._stepPaused do
-				debugger._miniEventLoop()
+			while debugger._stepPaused and not quit do
+				quit = debugger._miniEventLoop()
+			end
+
+			if quit then
+				debug.sethook()
+				love.event.quit()
 			end
 		end