Vahsi Uzman 1
Vahsi Uzman
Bvural41 1
Bvural41
OnurBoyla 1
OnurBoyla
Hikaye Ekle

Sanii switchbot - Memory Leak Fix

  • Konuyu başlatan Konuyu başlatan Agora Metin2
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 9
  • Görüntüleme Görüntüleme 857

HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!

Yapalı baya oldu o yüzden %100 case'i hatırlamıyorum ama event devam ederken iptal etmeye çalışıldığı için core crash yaşanıyordu, windows geliştirme ortamında yaşamıştım yanlış hatırlamıyorsam freebsd'de sorun olmayabilir:


new_switchbot.h


Arat:
Kod:
void Pause();

Altına Ekle:
Kod:
void ClearEvent(); // Clear event pointer (called from event handler)

new_switchbot.cpp

Arat:
Kod:
info->pkSwitchbot->SwitchItems();

Altına Ekle:

Kod:
    if (!info->pkSwitchbot->HasActiveSlots())
    {
        info->pkSwitchbot->ClearEvent(); // Clear event pointer
        return 0; // Stop event
    }


Arat:

Kod:
void CSwitchbot::Pause()
{
    if (m_pkSwitchEvent)
    {
        event_cancel(&m_pkSwitchEvent);
        m_pkSwitchEvent = nullptr;
    }
}

Altına Ekle:

Kod:
void CSwitchbot::ClearEvent()
{
    m_pkSwitchEvent = nullptr;
}

Arat:
Kod:
info->pkSwitchbot->SwitchItems();

Altına Ekle:

Kod:
    if (!info->pkSwitchbot->HasActiveSlots())
    {
        info->pkSwitchbot->ClearEvent(); // Clear event pointer
        return 0; // Stop event
    }

Arat:
Kod:
            if (!HasActiveSlots())
            {

İf bloğunu değiştir:
Kod:
                memset(&m_table.active, 0, sizeof(m_table.active));
                CSwitchbotManager::Instance().SendSwitchbotUpdate(m_table.player_id);
                return; // Exit early - event will stop when it returns 0


Arat:
Kod:
if (stop)

if bloğunu değiştir:
Kod:
            if (stop)
            {
                // Don't call Stop() here - we're inside the event handler
                // Just clear active flags and notify player
                memset(&m_table.active, 0, sizeof(m_table.active));

                if (SWITCHBOT_PRICE_TYPE == 1)
                    pkOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Switchbot stopped. Out of switchers."));
                else
                    pkOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Switchbot stopped. Not enough money."));

                CSwitchbotManager::Instance().SendSwitchbotUpdate(m_table.player_id);
                return;
            }
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst