View Issue Details

IDProjectCategoryView StatusLast Update
0005432Multi Theft Auto : San AndreasServerpublic2012-02-10 13:37
ReporterKaylAssigned Tolil_Toady 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
PlatformPC 32bitsOSWindowsOS VersionVista
Product Version 
Target Version1.3.1Fixed in Version1.3.1 
Summary0005432: Destroying source of onElementStopSync crashes the server
Description

When using onElementStopSync in order to determine that the owner of the vehicle is not syncing it anymore, if the vehicle is destroyed within the event handler, the server crashes. > destroyElement(source)

This works both for normal vehicles (entered by a player) and manually synced ones (setElementSyncer).

Steps To Reproduce

Code below is serverside.
Case 1:

  • Enter a vehicle as driver
  • Leave it and go away
    -> Crash
    Case 2:
  • Type /syncbug
  • Go away from the vehicle created
    -> Crash

function syncBug(player)
local x, y, z = getElementPosition(player)
x = x + 2
y = y + 2
local vehicle = createVehicle(602, x, y, z)
setElementSyncer(vehicle, player)
addEventHandler("onElementStopSync", vehicle, onVehicleOutOfSyncOfOwner)
end
addCommandHandler("syncbug", syncBug)

function onSyncBugVehicleEnter(player, seat)
if seat == 0 then
addEventHandler("onElementStopSync", source, onVehicleOutOfSyncOfOwner)
end
end
addEventHandler("onVehicleEnter", getRootElement(), onSyncBugVehicleEnter)

function onVehicleOutOfSyncOfOwner()
destroyElement(source)
end

Additional Information

The current workaround is delaying the destruction with setTimer(destroyElement, 50, 1, source).

TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change